toolbar Button Question

neonburner

Newcomer
Joined
Apr 16, 2003
Messages
2
hey , first off am stumbling from vb6 to .net ,
i want 2 close an instance of a form how would i do this?
heres what i got goin
Visual Basic:
Private Sub TB1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles TB1.ButtonClick
 
       Dim frm     As New Form2()
        Select Case TB1.Buttons.IndexOf(e.Button)
            Case 0
                frm    .Show()
            Case 1
                frm    .Dispose()
        End Select
    End Sub
 
Last edited by a moderator:
You'll have to declare frm outside the scope of that method. That way you'll be referring to the same instance of the form.
 
Back
Top