重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
定义一个TextBox类型的数组或者列表,然后把textbox都添加进去,就可以像你说的那么用了
成都创新互联公司于2013年开始,是专业互联网技术服务公司,拥有项目成都网站建设、网站设计网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元岚县做网站,已为上家服务,为岚县各地企业和个人服务,联系电话:028-86922220
Dim obj As Object, objName As String, i As Integer
i = 0
For Each obj In Me.Controls '枚举窗体所有控件
Debug.Print TypeName(obj)
If TypeName(obj) = "TextBox" Then '判读是否为文本框
i = i + 1
objName = obj.Name '获取文本控件名称,这里可以根据名称来判读赋值,也可以根据其他属性复制
obj.Text = "文本" i '文本框赋值
End If
Next
Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles _
RadioButton2.CheckedChanged, _
RadioButton1.CheckedChanged'8个radiobutton全加上
If CType(sender, RadioButton).Checked Then TextBox4.Text = CType(sender, RadioButton).Text
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged, TextBox3.TextChanged, TextBox4.TextChanged
TextBox1.Text = TextBox2.Text TextBox3.Text TextBox4.Text
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
TextBox3.Text = ComboBox1.Text
End Sub