vb.net怎么用代码创建一个Form,再添加一个退出按钮?
怎么用代码创建一个Form,再添加一个退出按钮?感觉这样写类代码,对类的理解和控件属性、方法的理解,会加深很多。
就像我以前问的VFP问题那样:
https://bbs.bccn.net/thread-459302-1-1.html
程序代码:Module Module1
Sub Main()
Dim fm As New Form
fm.ShowDialog()
End Sub
End Module
程序代码:Module Module1
Sub Main()
Dim fm As New MyForm
fm.ShowDialog()
End Sub
Public Class MyForm
Inherits System.Windows.Forms.Form
'Private Sub InitializeComponent()
'Me.Text = "用类的方式学习窗体和控件"
'Me.Controls.Add(Me.Button1)
'Me.Button1 = New System.Windows.Forms.Button
'End Sub
'Friend WithEvents Button1 As System.Windows.Forms.Button
End Class
End Module