Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I have just switched to vs.net. In visual basic 6.0, using windows forms, if I had a button on a form for example, and wanted to program that button to open another form in the project, I would just simply put in the code: MyForm.show and it would open the windows form that I created and saved in the project.

 

In vs.net, using vb.net, if I do this, it says that myForm is not declared. Why do I have to declare a form in the project that already exists? Do i really have to declare all the forms that are in my project to just open them? If so, how exactly do I do this. I have tried to dim a new form, but it opens a form that is blank and not the form i already made in my project What am I missing here? I want to simply open my forms when users click on buttons, not new forms generated on the fly, EXISTING forms.

 

This seems like such a simple thing to do but I have literally tried for hours to find something on this and can't. vs.net documentation is really shabby on simple things. Please help, thanks.

 

-JBD

  • Leaders
Posted

Have you tried:

Dim Fnum As Form
Fnum = New MyForm
Fnum.Show()

:)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

Posted

Okay, thanks. You helped enough where I at least got it to work.

 

this works:

 

dim myform as new myform

myform.show()

 

Still though, it requires an extra line of code to dim my forms, sort of a pain. Why did they do that?

 

Should I create a module and dim all my forms like this so I dont have to do this everytime I want to open one of my forms?

 

thanks.

  • *Experts*
Posted
If im not mistaken, VB6 had to create a default instance of the form for you. One needs to be created in VB.NET too, but you yourself have to create that instance.

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