Ask the Expert

How is a form loaded in VB.NET?

I have converted my VB 6.0 project over to VB.NET. I am having a problem with a load form call. In VB.NET, how is a form loaded? This is the original code: Load frmTest. How is this done in VB.NET?
Private Sub Button1_Click(ByVal sender As System.Object, _
                          ByVal e As System.EventArgs) _
                          Handles Button1.Click
    ' Show the form as a modaless window.
    Dim x As Form2 = New Form2
    x.Show()
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, _
                          ByVal e As System.EventArgs) _
                          Handles Button2.Click
    ' Show this form as a dialog.
    Dim x As Form3 = New Form3
    x.ShowDialog(Me)
End Sub

This was first published in January 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: