user3292210
user3292210

Reputation: 13

Run VB.net program minimized

https://i.sstatic.net/3jq0F.png

As shown in the picture, I want my vb.net application to run minimized like that a show a pop-up when the minimize button is hit. Is there a way I can do that?

Upvotes: 1

Views: 6055

Answers (1)

chris_techno25
chris_techno25

Reputation: 2487

Try this...

You can use the notifyicon control...Hide the form when it's minimized and show the notifyicon, otherwise, show the form and hide the notifyicon control...

Add notifyicon control

Add this code under the form resize event

 If Me.WindowState = FormWindowState.Minimized Then
     Me.WindowState = FormWindowState.Minimized
     NotifyIcon1.Visible = True
     NotifyIcon1.ShowBalloonTip(5, "System", "DoubleClick on the Icon to restore the application.", ToolTipIcon.Info)
     Me.Hide()
 End If

Under the doubleclick event of notifyicon control, add this code...

 Me.Show()
 Me.WindowState = FormWindowState.Maximized
 NotifyIcon1.Visible = False

Upvotes: 2

Related Questions