Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Next Button Close Current Form, Open Another
Okay, I am a student and am at the very end of my introductory VB class. I need to create a project and I already have what I am going to do in my mind. However, I am completeing one of the last assignments of regular work and sadly enough some of the very basic elements have been left out of this class.
So, we are just now going back and learning creating a splash page and multiplle forms.
Here is my set up, and this is very basic (as was instructed). I have a splash page (splashForm), and two pages (mainForm & thirdForm). I have created a startUp.vb that has the code to display the splash page first, then the main form after 5 seconds. Okay, so far so good - that all works.
Now, on my mainForm, I have one button - a Next button. The purpose is to open the next form - thirdForm.
On thirdForm, I have 2 buttons - one to go back to the mainForm and one to close the application.
Here is my delimma - I cannot figure out how to create the code so that when I click on the Next button on mainForm it will hide the main form window and open the thirdForm window. And then when I click back it does the opposite (hide thirdForm and show mainForm again).
I can get this functionality to only work half right. I can get it to display the new window, but it still shows the old one as well. Here is the code I am using.
[CODE]Public Class mainForm
' handles Next Button's Click event
Private Sub nextButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles nextButton.Click
End Sub ' nextButton_Click
End Class ' mainForm[/CODE]
When I use this, it opens the thirdForm, but then both close immediately.
Here is my code for thirdForm:
[CODE]Public Class thirdForm
' handled backButton's click event
Private Sub backButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles backButton.Click
' close this for and go back to main form
End Sub ' backButton_Click
' handles close Button's click event
Private Sub closeButton_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles closeButton.Click
' close this window, exit program
End Sub ' closeButton_Click
End Class ' thirdForm [/CODE]
So being that I am a beginner, I am probably either making a stupid error or am way off. Can someone please help me with this. By the way, I am sure there may be several ways to do this, so the simplest way would be best at this point. There is no other functionality on my forms other than a label that has text. I do understand the difference between modal and non-modal forms, but am not sure I am applying them correctly.
0 · ·