Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Ok so this seems like a really easy question and Im sure there's an obvious answer but how the heck do I open a new form (form2) and close the first one (form1). Form1 is the form that is first loaded when the program starts.

 

I tried to do

 

Dim frm2 as new form2

frm2.show

Me.close

 

but the application just closes alltogether. Any help would be appreciated thanks.

  • *Experts*
Posted
The application closes all together because the first form is the form that your application loop depends on. What you could do for example it hide that form.
Posted

hi

 

just add a Module from project Menu

 

give it a name for example StartModule

 

and wirte this code

 


Sub Main()
       Dim frm1 As New Form1()
       frm1.Show()
       Application.Run()
   End Sub

   Public Sub Closer()
       Application.Exit()
   End Sub

 

 

now go to the Start Up project : by rigth click on your project

 

in solution explorer and select the StartModule

 

to be the start up object "" Taht's all

 

now you can close the frm1 (form1) by calling

 

me.Close() Method And Close application alltogether

 

by calling the Closer() sub it's Global Method

 

that exist in our StartModule

 

I hope it help bye

Gary Says: To be a good programmer, you must be good at debugging

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...