[RESOLVED] New form and how to use

ss7thirty

Well-known member
Joined
Jun 14, 2005
Messages
455
Location
New Jersey, US
Programming Experience
5-10
I am having trouble having a new form pop-up without being blank for some reason. I create the new form with just a simple listbox that i want to have on it. And on form1 when you click an option in the main menu form2 is supposed to pop up

I alread have form2 drawn out and form1 is all done also. So in the event that menu item 2 it clicked i write:

Dim form2 as new form2()
form2.show()

and then i create all the controls that i want on form2 as you would when creating any form. But when the program runs the form shows up blank when i click that option.

CAN ANYONE TELL ME HOW TO FIX THIS PROBLEM?
 
Last edited:
First of all, it is bad practice to use the class name as an instance name. It can lead to confusion as to whether you are referencing the class or the instance.

Just to clarify, are you saying that you create the form2 class, complete with controls, in the designer but when you show an instance of form2 the controls are not displayed? Have you tried to access any of the controls to see if they actually exist or not? If they do exist, check their Visible and Location properties.
 
Response to your response

yes when i run the program form1 comes up and i assigned main menu item to to "form2.show()" and when you click this item form2 comes up but with none of the controls that i put on form 2 in the designer. But i will try what you said. Thanks for the reply i am pretty new to VB.NET just started taking classes a little while ago
 
Resolved

Thanks for the help I finally figured it out. I simply had to make all of the things visible using the onload form2 event and that worked. Thank you very much for the help
 
If there's no reason for the controls in form2 to be invisible, youu can also set their visible property in the designer. When you add a control to the form designer the default value of the visible property is True, perhaps you changed this to False?
 
Back
Top