Prompt out main form through login

L

Lurc

Hi all,

2 forms, one is login form, another is main form.

Once login operation is granted, it will bring out main form and kill login
window. How can I do it? Like

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOK.Click

......
If bDone = True Then
Dim frmMain As Form1

frmMain = New Form1
frmMain.Show()
'Kill frmLogin
......
End If
End Sub
 
C

Cor Ligthert

Lurc,

For things as a login form is the

ShowDialog instead of Show

And than start from your mainform and not vica versa.

In the way you want to do it now, becomes your login form your toplevel
class, and therefore you have to keep it alive as long as your application
runs.

I hope this helps,

Cor
 
L

Lurc

Hi Cor,

Thanks.

If so it sounds ridiculous to me, main form is opened with a login dialog
window on background. Is there any other approach work around?
 
C

Cor Ligthert

Lurc,

When you set the login form in the loadevent of the mainform, than that
class is opened, however the form is not yet showed. You are not the only
one who uses a login form.

However, did you ever looked at the standard IsInrole functions from Net.
(better from the OS). Than you don't need a login form at all.

I give you this page because it is easier to start from.

http://msdn.microsoft.com/library/d...incipalwindowsprincipalclassisinroletopic.asp

I hope this helps,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top