Linking Forms - Please Help! Im New to VB

How do you make a command button link to another form in the same project?
[87 byte] By [Joshua-Programmer] at [2007-12-24]
# 1

actually what do you want to do?

you can show the form as ShowDialog() on the button click event to show the form as modal dialog.

show() to simply show the form

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click

dim frm as New Form1()

frm.Show()

end sub

PrasantSwain at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 2
I have a command button in form1 and i want the button when clicked to open form2 in my project.
Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 3

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click

dim frm as new Form2()

frm.Show()

end sub

PrasantSwain at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 4

as suggested that would be the correct way of doing so. Adapting to your solution, double click the button then type this:

Dim theForm as new Form2()

theForm.Show() 'Or ShowDialog() depending on how you wish to show your form

ahmedilyas at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 5
ill try that
Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 6
it says compile error
Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 7
what is the error? and if possiable post the code you have written?
PrasantSwain at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 8
Expected end of statement, what exact code to i put in the command button code thing to open the form2 when clicked? im really confused
Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 9
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click

dim frm as new Form2()

frm.Show()

End Sub

Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 10

it the name of your button is btn if no then.

change the code as fallows

Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles <your button name>.Click

dim frm as new Form2()

frm.Show()

End Sub

it will better you double click on the button in the desing form and on the code put the two line to show the form in side the click event.

dim frm as new Form2()

frm.Show()

PrasantSwain at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 11
i still cant get it to work dont worry - ill ask my teacher if he knows got to go now bye
Joshua-Programmer at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...
# 12
Hi.

form2.show ()

That should do it :)

Neotech at 2007-10-8 > top of Msdn Tech,Visual Studio Express Editions,Visual Basic 2005 Express Edition...