prevent form from being minimised

andrew_c_2000
09-22-2003, 10:13 AM
hi, how do u prevent a form from being minimised, so that it is always the top form!

00100b
09-22-2003, 10:17 AM
Trap for the WindowState in the Form_Resize event and if vbMinimized, then set the WindowState to either vbNormal or vbMaximized.
ie

Private Sub Form_Resize()

If Me.WindowState = vbMinimized Then
Me.WindowState = vbNormal
End If

End Sub

andrew_c_2000
09-22-2003, 10:21 AM
This works, but the form loads is a popup like way, and i dont want the user to be able to click back on to the main form, and therefore the popup gets hidden behind it.





Trap for the WindowState in the Form_Resize event and if vbMinimized, then set the WindowState to either vbNormal or vbMaximized.
ie

Private Sub Form_Resize()

If Me.WindowState = vbMinimized Then
Me.WindowState = vbNormal
End If

End Sub

reboot
09-22-2003, 10:26 AM
Show it modally then.

YuanHao
09-22-2003, 10:27 AM
Use MDI child forms and change the Form's modality, I think that might do the trick.

andrew_c_2000
09-22-2003, 10:42 AM
how is that done??????????

zak2zak
09-22-2003, 10:52 AM
Sorry May I Interupt?
MDIchild form cannot be shown modally?
U will get this error:
Runtime error '404'
MDI child forms cannot be shown modally

To Be Able To Do As U want U Have to Make the Form Not a MDIChild form
Then U Can Load It Modally

Form1.Show vbModal

YuanHao
09-22-2003, 10:53 AM
Form.Show vbModal, Me

andrew_c_2000
09-22-2003, 10:59 AM
PLease explain, i dont undersatand, all i want is for the popup form (form1) to be always on top

zak2zak
09-22-2003, 11:02 AM
How Do U trigger Form1 To Load?
May be if U Post That Code It May Help..

andrew_c_2000
09-22-2003, 11:05 AM
all done, but how do i make the popup appear in the middle???

zak2zak
09-22-2003, 11:12 AM
This Will Helps..

Private Sub Form_Resize()
Me.Move (Screen.Width - Me.ScaleWidth) / 2, (Screen.Height - Me.ScaleHeight) / 2
End Sub

00100b
09-22-2003, 12:24 PM
Or set the StartupPosition property of the form to either 1 - CenterOwner or 2 - CenterScreen

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum