Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?.

tHe pHrEaKy
  • *Experts*
Posted

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.

Posted
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).
tHe pHrEaKy
  • *Experts*
Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...