joeybagadonutz Posted November 26, 2003 Posted November 26, 2003 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 Quote
Leaders Iceplug Posted November 26, 2003 Leaders Posted November 26, 2003 Have you tried: Dim Fnum As Form Fnum = New MyForm Fnum.Show() :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
joeybagadonutz Posted November 26, 2003 Author Posted November 26, 2003 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. Quote
*Experts* mutant Posted November 26, 2003 *Experts* Posted November 26, 2003 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. Quote
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.