Windows Develop Bookmark and Share   
 index > Windows Forms General > Declare New Form
 

Declare New Form

In vb6 I could do the Following:

Private Sub Button1_Click()

Dim frmN As New Form1

Set frmN = New Form1

frmN.Show

End Sub

I cant figure out how to do this in VB2005

Can someong Help Me

Inclement  Friday, March 02, 2007 10:30 PM

Hi,

just lose the "Set" keyword... VB IDE should do that for you automatically. Note however, that a new form is already instatiated in the first statement (Dim frmN as New Form1) so there's no need for the next one.

If this doesn't solve your problem, please give some more details on what's not working with your code.

Andrej

Andrej Tozon  Sunday, March 04, 2007 11:02 PM

Hi,you can do in this way

Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim frm As New Form2

frm.Show()

End Sub

I hope it helps.

Gavin Jin - MSFT  Monday, March 05, 2007 1:31 AM

Hi,

just lose the "Set" keyword... VB IDE should do that for you automatically. Note however, that a new form is already instatiated in the first statement (Dim frmN as New Form1) so there's no need for the next one.

If this doesn't solve your problem, please give some more details on what's not working with your code.

Andrej

Andrej Tozon  Sunday, March 04, 2007 11:02 PM

Hi,you can do in this way

Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim frm As New Form2

frm.Show()

End Sub

I hope it helps.

Gavin Jin - MSFT  Monday, March 05, 2007 1:31 AM

You can use google to search for other answers

Custom Search

More Threads

• how to use CRL component class?
• paste event?
• Theme override & mp3 visualizations
• how do i change the text size of richtextbox
• What's the Windows Form Equivalent to the ASP Drop down list
• Paint order of child controls
• Enable / disable datagridview depending on column data of another datagridview
• to check the file is in use +C#
• treeview scrollbar event (detecting/controlling)
• ResX en-US static class gets blown out