How do you check if a user has minimized a form?
VB Code:
Private Sub Form1_<whatever it is!>
Printable View
How do you check if a user has minimized a form?
VB Code:
Private Sub Form1_<whatever it is!>
try this ...
VB Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e _ As System.EventArgs) Handles MyBase.Resize If Not FormWindowState.Minimized = True Then MsgBox("Minimized") End If End Sub
All I get is the message box saying "Minimized", I click ok to get rid of it, and back it comes, I had to shut the program down using the Task Manager!
(I Build the Solution and run it from a shortcut on my TaskBar, I don't run it from within VB).
I have the WindowState as Maximized, perhaps that's causing the problem.
Did you try the code without "Not" ?Quote:
Originally posted by pirate
try this ...
VB Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e _ As System.EventArgs) Handles MyBase.Resize If Not FormWindowState.Minimized = True Then MsgBox("Minimized") End If End Sub
this won't work either . try with other size events (changesize and maximizedchange (I think)
yeah, I tried that after I posted the message, seemed more logical without the not but then I got no message.
Perhaps the problem is that i'm not actually resizing the Form, just minimizing (although you'd think that minimizing would call the Resize).
I've tried different things but I'm stuck. :(
I know this isn't solution but it might be ......one of the available till now :D , Cute UI. (I like when I draw my style on my app.)
Novel way :D , but not quite what I had in mind.
Back here :D ,
try this , it should work
VB Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e _ As System.EventArgs) Handles MyBase.Resize Select Case Me.WindowState Case FormWindowState.Minimized 'MsgBox("Minimized") Case FormWindowState.Maximized MsgBox("Maximized") Case FormWindowState.Normal 'MsgBox("Normal") End Select End Sub
Thanks Pirate!