Click here to Skip to main content
16,020,990 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a login form for MySQL db, when i click log out from the MAin form, I make the log in form to show, but it doesn't stop someone from using the other forms, How do i make this form stand out on top of other form or make the system not usable unless one logs in.

Thanks in advance..
Posted

1 solution

Since you are talking about forms, I assume this is WinForms?

If so then just use
if (myLoginForm.ShowDialog() == DialogResult.OK)
   {
   ...
   }
The ShowDialog method halts processing until the user has responded or closed the form.


"the forms you create in VB are WinForms? Well
am using this code:
Dim frm As New frmLogin
frm.MdiParent = Me
frm.ShowDialog()
When i add frm.ShowDialog(DialogResult.OK) it says it cant be converted to win32 forms"



Sorry - C# rather than VB:
Dim frm As New frmLogin
If frm.ShowDialog() = DialogResult.OK Then
   ...
End If
 
Share this answer
 
v2
Comments
joseph k 25-May-11 4:17am    
the forms you create in VB are WinForms? Well
am using this code:
Dim frm As New frmLogin
frm.MdiParent = Me
frm.ShowDialog()
When i add frm.ShowDialog(DialogResult.OK) it says it cant be converted to win32 forms
OriginalGriff 25-May-11 4:23am    
Answer updated
joseph k 25-May-11 4:26am    
Ok I got it This is the code in VB, C# is different.
Dim frm As New frmLogin
frm.ShowDialog()
It works very well

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900