16,554
社区成员
发帖
与我相关
我的任务
分享
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Private _txt As String
Public Event btnClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Public Overrides Property text() As String
Get
Return _txt
End Get
Set(ByVal value As String)
_txt = value
TextBox1.Text = _txt
End Set
End Property
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RaiseEvent btnClick(Me, New EventArgs)
End Sub
End Class
Public Class Form1
Private Sub UserControl11_btnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles UserControl11.btnClick
UserControl11.text = "sfsf"
End Sub
End Class
Public Class UserControl1
Inherits System.Windows.Forms.UserControl
Private _txt As String
Public Overrides Property text() As String
Get
Return _txt
End Get
Set(ByVal value As String)
_txt = value
TextBox1.Text = _txt
End Set
End Property
End Class
'新建一个类
'开头加 Inherits System.Windows.Forms.TextBox 那就是继承TEXTBOX
'新建一个类
'开头加 Inherits System.Windows.Forms.BUTTON 那就是继承BUTTON