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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pop-up Windows Form 1

Status
Not open for further replies.

cosmoh2o

Programmer
Jul 22, 2002
92
US
Does anyone know how to create a pop-up windows form that is called from another windows form in VB .NET?

The idea is to have a "main" form with a button that is clicked. When the button is clicked, another window form ("second_form") is brought up that has a dynamic radiobuttonlist which can then be selected. I know that this can be done with Web Applications (aspx) but I would like to know if it can be done as a stand-alone Windows executable. I am developing this program with Visual Studio 2002 Standard. Any help would be greatly appreciated. Thanks in advance.
 

The following sample pop-ups Form2 with a RadioButton, on click event of a button on Form1.

Private Sub onButtonClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New Form2()
Dim radioButton1 As New RadioButton()

' Initialize the RadioButton control.
radioButton1.Size = New Size(192, 16)
radioButton1.Text = "New Radio Button"

' Add the RadioButton control to the form.
frm.Controls.Add(radioButton1)

frm.ShowDialog(Me)
End Sub

 
Thank you PankajBanga. That is exactly what I was needing to know. So, a Windows Form in VB .NET is just a Class?
 
Indeed. Everything in .Net is a class. Even strings and integer have methods!

Craig
 
Well, that makes everything easier. While I'm at it, does anyone know how to print a windows form. I can't seem to find much information on the subject? I would like the current form to be sent to the computer's default printer. I am using Visual Studio 2002 Standard (with VB .NET).
Any help/hints would be great. And thanks for all the great help so far. You guys really know your stuff when it comes to VB .NET.
 
Thanks PankajBanga you have been very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top