简体   繁体   中英

How to properly close form1 after showing form2

I have a script editor that I'm using to code through the object model of software my company uses. It has a login form to make sure that you are able to access the system and a main form to pull the script from the object and edit using ScintillaNET.

The issue that I am having is when I pass the object to the main form and leave the login form open it runs smoothly but I want to close the login form after the main form is open. When I do this it stops immediately after opening the main form.

Here is a sample of my code. You can see for now that I have commented out the line Me.Close() as that seems to the issue.

' Close this form, show the main form and pass the M3 object to it
   Dim f As FormMain = New FormMain
  ' Pass the M3 object to next form
   f.M3System = M3System
   f.Show()
  'Me.Close()

any help would be awesome!!!

This is a built-in feature for VB.NET. Use Project + Properties, Application tab.

Change the Shutdown mode setting to "When last form closes".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM