Opening a window and then closing self

  • Thread starter Thread starter UJ
  • Start date Start date
U

UJ

I am trying to do a login screen and can't figure out how to get the new
window to open after I have verified the user info. I tried the following:

dim win_Main as MainWindow

win_Main = new MainWindow
Main.Show()
me.close()

but as expected, everything closes down. There must be an easy way to do
this that I just don't know about. I also am going to need to transfer
things to the new window (like the username, privs, ...) any help would be
appreciated.

TIA

UJ.
 
UJ said:
I am trying to do a login screen and can't figure out how to get the new
window to open after I have verified the user info. I tried the following:

dim win_Main as MainWindow

win_Main = new MainWindow
Main.Show()
me.close()

but as expected, everything closes down. There must be an easy way to do
this that I just don't know about. I also am going to need to transfer
things to the new window (like the username, privs, ...) any help would be
appreciated.

\\\
Public Module Program
Public Sub Main()
Dim f As New Form1()
f.Show()
Application.Run()
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object. Place the
code below in a button's 'Click' event handler:

\\\
Dim f2 As New Form2()
f2.Show()
Me.Close()
///

You can exit the application by calling 'Application.ExitThread'. Take a
look at the 'ApplicationContext' class too.
 
UJ,

The most simple thing for answers on this is seaching the newsgroups in
Google, your question is asked 1000 times at least.

The in my opinion most simple approach

In the load event of your main form.
\\\
dim frm as new LoginForm
frm.showdialog
loginname = frm.loginname 'where loginname is a public property or field in
LoginForm
password = frm.password 'see above
frm.dispose
///
I hope this helps?

Cor
 
UJ said:
I am trying to do a login screen and can't figure out how to get the new
window to open after I have verified the user info. I tried the following:

dim win_Main as MainWindow

win_Main = new MainWindow
Main.Show()
me.close()

Might be too basic for you - but this might be of some assitance as well:
http://www.codeproject.com/useritems/WorkingWithWinForms.asp


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
 
Thanks Herfried. That worked.

Herfried K. Wagner said:
\\\
Public Module Program
Public Sub Main()
Dim f As New Form1()
f.Show()
Application.Run()
End Sub
End Module
///

In the project properties, select 'Sub Main' as startup object. Place the
code below in a button's 'Click' event handler:

\\\
Dim f2 As New Form2()
f2.Show()
Me.Close()
///

You can exit the application by calling 'Application.ExitThread'. Take a
look at the 'ApplicationContext' class too.
 

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

Back
Top