Novice to .NET - Activate a Form?

phreaky

Regular
Joined
Dec 7, 2002
Messages
71
Location
Caracas, Venezuela
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?.
 
What do you mean "activate"?

If you mean you wish to open another form, you do it this way:
Visual Basic:
Dim frm As New frmMain()
frm.Show()
Where frmMain is the name of the form you want to
show.
 
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).
 
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.
 
Back
Top