【发布时间】:2021-02-26 07:21:00
【问题描述】:
所以我在这里尝试创建一个动态文本框,每个文本框都有不同的功能 但遗憾的是消息框不起作用我正在学习自我学习这个,我很难过。谁能告诉我我做错了什么?
Public Function AddNewTextBox() As System.Windows.Forms.TextBox
Dim txt As New System.Windows.Forms.TextBox()
Me.Controls.Add(txt)
txt.Top = cLeft * 25
txt.Left = 100
txt.Text = "TextBox " & Me.cLeft.ToString
txt.Name = "TextBox" & Me.cLeft.ToString
cLeft = cLeft + 1
Return txt
AddHandler txt.TextChanged, AddressOf Me.text_change
Dim txt1 As New System.Windows.Forms.TextBox()
Me.Controls.Add(txt1)
txt1.Top = cLeft * 15
txt1.Left = 90
txt1.Text = "1 " & Me.cLeft.ToString
txt1.Name = "TextBox" & Me.cLeft.ToString
cLeft = cLeft + 1
Return txt
AddHandler txt1.TextChanged, AddressOf Me.text1_change
End Function
Private Sub text_change(ByVal sender As System.Object, ByVal e As System.EventArgs)
MessageBox.Show("The First Text has Been Change.")
End Sub
Private Sub text1_change(ByVal sender As System.Object, ByVal e As System.EventArgs)
MessageBox.Show("The Second Text has Been Change.")
End Sub
【问题讨论】: