Public Class Form1
Inherits System.Windows.Forms.Form
" Windows 窗体设计器生成的代码 "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim fm As Form2
fm = New Form2(Me)
fm.Show()
End Sub
End Class
Public Class Form2
Inherits System.Windows.Forms.Form
" Windows 窗体设计器生成的代码 "
Dim fm1 As Form1
Public Sub New(ByVal fm As Form1)
MyBase.New()
InitializeComponent()
'存储Form1的实例
fm1 = fm
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
fm1.TextBox1.Enabled = Not fm1.TextBox1.Enabled
End Sub
End Class