954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do you switch between forms in vb.net?

I am learing vb.net currently on my own and I have two questions.

1. How do you switch between forms via a button command?

2. I have .net student version and I would like to know how to package a .exe for a computer without .net installed.

These are driving me crazy - I can do it in VB6 but I am lost here.

Thank you for any help,

Greg

MasterNovice
Newbie Poster
1 post since Jul 2004
Reputation Points: 10
Solved Threads: 0
 

I am learing vb.net currently on my own and I have two questions.

1. How do you switch between forms via a button command?

2. I have .net student version and I would like to know how to package a .exe for a computer without .net installed.

These are driving me crazy - I can do it in VB6 but I am lost here.

Thank you for any help,

Greg

Can you please tell me how to do it on VB6? Its killing me too!

Big Birtha
Newbie Poster
1 post since Dec 2004
Reputation Points: 10
Solved Threads: 0
 
form2.Show
form1.Hide


?? Not exactly sure ... I did something like that in middle school though!

cscgal
The Queen of DaniWeb
Administrator
19,424 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 230
 

what if form1 has three radio buttons and a command button. clicking one of the fist two buttons and the command button should open form2 and clicking third radio button and the command button should open form2. How do u code it in VB.Net?

learningvb
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

what if form1 has three radio buttons and a command button. clicking one of the fist two buttons and the command button should open form2 and clicking third radio button and the command button should open form3. How do u code it in VB.Net?...wrote the question wrong first time!!

learningvb
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

Do something like this on the on click event of the command button

IF radiobutton1.checked = True OR 
    radiobutton2.checked = True
  THEN form2.displaydialog
 ELSE
    form3.displaydialog


You can use a case statement also but I do recommend using the form.displaydialog as opposed to form.show that way you can't move back to the parent form until the opened one is closed. You can also hide the parent form by adding in form.hide.

Seamus0291
Newbie Poster
2 posts since Jul 2007
Reputation Points: 10
Solved Threads: 0
 

its so simple,to switch between forms--using command button
onclick () event of command button-just write has response.redirect("tothepage.aspx")

2)And to create .exe for an web-project..on the project name-right click& click on build solution,,,,
If i am,n2 correct -plz specify what is wrong....

preetham.saroja
Junior Poster in Training
82 posts since Jun 2007
Reputation Points: 5
Solved Threads: 1
 

Hi,

write this code in Command Click event:

If RadioButton1.Checked = True Or RadioButton2.Checked=True  Then
 Form1.Show
Else
 Form2.Show
End if


Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Hi,

Every time u Build and run ur project, An "Exe" file is created in The "Bin" folder of the application path, u can use this Exe to re-distribute.
To Create Set-up Package Check This
In Client machine u have to install "Runtime .Net Framework", And Run The Set-Up Created above.

Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

I have similar problem .
Ihave 2 forms , iwant to enter variables on form1 and show them in form2
This what i have soo far
form1
=====
Private Sub Button1_Click(val blala)
Fnamesender = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub

form2
=====
Private Sub Form2_Load(ByVal blabla bla)

Label.text = Fnamesender
end sub

i have a mudule
===========
Module one
Public Fnamesender As String

end module


The Problem is when i enter a text in TextBox2 in form1 and view it in Label its ok , but if you go back to form1 and enter a name in textBox2 it doesnt change in label . how can i clear label.text

babaze
Newbie Poster
2 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

I have similar problem .
Ihave 2 forms , iwant to enter variables on form1 and show them in form2
This what i have soo far
form1
=====
Private Sub Button1_Click(val blala)
Fnamesender = TextBox2.Text
Me.Hide()
Form2.Show()

End Sub

form2
=====
Private Sub Form2_Load(ByVal blabla bla)

Label.text = Fnamesender
end sub

i have a mudule
===========
Module one
Public Fnamesender As String

end module


The Problem is when i enter a text in TextBox2 in form1 and view it in Label its ok , but if you go back to form1 and enter a name in textBox2 it doesnt change in label . how can i clear label.text ??

babaze
Newbie Poster
2 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 
I am learing vb.net currently on my own and I have two questions. 1. How do you switch between forms via a button command? 2. I have .net student version and I would like to know how to package a .exe for a computer without .net installed. These are driving me crazy - I can do it in VB6 but I am lost here. Thank you for any help, Greg



Answer:
1. Dim obj as new Form1
obj.MdiParent = Me
obj.show()
2. Just install .Net Framework

shah134pk
Newbie Poster
8 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

You can also use the Package and Deployment project. Also there are options like Install Shield and Click Once which is bundled with VS 2005.

binoj_daniel
Practically a Master Poster
645 posts since Dec 2006
Reputation Points: 25
Solved Threads: 18
 

If you are using any legacy COM components then you have packages those dll files and the correspinding interop files along with the application in the application folder.

binoj_daniel
Practically a Master Poster
645 posts since Dec 2006
Reputation Points: 25
Solved Threads: 18
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You