phreaky Posted December 8, 2002 Posted December 8, 2002 Well, another dummy question, but I'm still getting involved with .NET and I have some doubts about changes made in this new language, how do I activate another form with a button?, I mean, I'm programming a button in the Form1, how can I activate the Form2 using this button event of clicking?. I have investigated in this same forum how to unload a Form (using the Close(Me)), but how do I call to another Form?. Quote tHe pHrEaKy
*Experts* Volte Posted December 8, 2002 *Experts* Posted December 8, 2002 What do you mean "activate"? If you mean you wish to open another form, you do it this way:Dim frm As New frmMain() frm.Show()Where frmMain is the name of the form you want to show. Quote
phreaky Posted December 8, 2002 Author Posted December 8, 2002 Thanks, well yes, I meant opening it, but I tried what you said (in fact, as I told, it was the normal way to do it in VB6), but it appears not to be working on .NET, it marks my code: Form2.Show (), like it's wrongfully coded or wirted (I didn't declare the variable Form2 as a form BUT I created the new form, so it should be working, because it exists). Quote tHe pHrEaKy
*Experts* Volte Posted December 8, 2002 *Experts* Posted December 8, 2002 You need to declare a variable as New Form2, and then use myVariableName.Show. See my example above, I am not using frmMain.Show, but frm.Show, because frm is the variable I created to hold the form. Quote
phreaky Posted December 8, 2002 Author Posted December 8, 2002 Many thanks, it worked perfectly! :D Quote tHe pHrEaKy
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.