-
Oct 1st, 2014, 10:41 PM
#1
Thread Starter
Lively Member
how to close a form correctly
Code:
Public Class frmDataInput1
Private Sub frmDataInput1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'Display Form Title
Me.Text = "Hasselburg Tie " & frmStartUp.CmbTieSize.Text & " Data Input"
'Closes Form Startup
frmStartUp.Close()
End Sub
End Class
The first User form that appears is Start up form. This is where the user picks the product type. Depending on the product type selected, will determine the user form that opens next. In this case, form Data Input 1 opens. What I need to see happen is that when the user selects the product from the start up and opens the designated form it should then close the Start up form and leave open the frmDataInput1. However, that does not occur. When I select the product that would use this form it opens it up and closes it when the form start up closes. But if I change frmStartUp.Close() to frmStartUp.Hide() , it then does what I want it to do. I don't want to have more than one form open in memory. Is there a way to fix this? thanks
-
Oct 1st, 2014, 10:47 PM
#2
Re: how to close a form correctly
in your vb menus:
Project-->Properties-->Shutdown Mode-->When last form closes
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Oct 1st, 2014, 10:49 PM
#3
Fanatic Member
Re: how to close a form correctly
Its little difficult to understand what you are trying to achieve.
But Do you want that when the user select the product so the desired form will open and the current form closes? is it what you want?
-
Oct 1st, 2014, 11:01 PM
#4
Thread Starter
Lively Member
Re: how to close a form correctly
The first form that appears is the startup form. Once the user selects the product from that startup userform. The startup form closes and opens the form that corresponds to the selected product. I am running visual studio 2012. .Paul, when I went to my program's properties, I did not seem anything in regards to Shutdown mode. Thanks to both of you for your help.
-
Oct 1st, 2014, 11:07 PM
#5
Fanatic Member
Re: how to close a form correctly
Add a line of code to our code, after
frmStartup.close
Code:
Correspondingform.show
-
Oct 1st, 2014, 11:16 PM
#6
Re: how to close a form correctly
sorry, try:
Project-->Properties-->Application-->Shutdown Mode-->When last form closes
it's definitely there (I checked all versions from 2008-13)...
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Oct 1st, 2014, 11:19 PM
#7
Re: how to close a form correctly
also you need to open the new form before closing the first form. as 'when last form closes' implies, it will end the application as soon as there are no forms open
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|