Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load/show/open another form 4

Status
Not open for further replies.

fishysheep

Programmer
Oct 13, 2001
54
GB
Hi

such a easy thing to do but i can't find out how...

project and two forms (form1 and form2). Want to load form2 from form1 at run time - HOW???

Mike
 
hie,

Forms are classes in VB.NET. And obviously class cannot
be used until it is initiated.


<color blue>

dim frm as new form2
frm.show

</color>

Bye
Imran Make habit of marking posts as helpful or expert post, if they do solve your problems.
 
Hi

Think of a vb.net form as a child from in VB6 and that should give you some idea of whats going on.

getimran is correct when he mentions classes/objects - and that's exactly what you were doing with child forms in vb6. The child form in the project explorer window needed to be instanced by means of the NEW keyword and you could have as many instances of that child form as required. The original one was the class - the instances were all objects. The same applies to forms you create in VB.NET.

Kate
 
Can someone tell me a little bit more detailed how i can load a form then, the controls are already placed on it and it has its own name. Because when I try:

Dim frmName as New Form()
frmName.Show()

I get an empty form... How can i make it the form I already made?
 
bOEmAN,
After you have made your form and named it let's say that it is call form2.

in the program you must decliar a form(what everyou want to call it) let's say frmtest as system.windows.forms.form

then when you are ready to open up your form

dim frmtest as new form2(the form you created)
frmtest.show

example

general declarations
public frmtest as system.windows.forms.form

then in your proceedure
dim frmtest as new form2
frmtest.show


Dan




 
I have an MDI Parent form (frmMain.vb) that I wish to load at my app startup.

My startup location is Sub Main (inside modMain.vb).
I have the following code:

Module modMain

Public Sub Main()
Dim frm As New frmMain()
frm.Show()

End Sub
End Module

my application starts and immediately ends reporting no errors.

what am i doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top