Vb.net窗口调用问题

源代码:

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim frm2 As New Form2
   
         frm2.Show()

    End Sub

这样每次点击按钮都会产生新的form2窗口

修改后

dim f2 as new Form2

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If f2 Is Nothing Or f2.IsDisposed Then

f2 = New Form2

End If

 f2.Show()

 End Sub

阅读更多
文章标签: vb.net button
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭