vb.net中怎样在代码中向combobox赋值,
展开全部
添加项: ComboBox1.Items.Add("123")
直接赋值: ComboBox1.Text = "123"
======================
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 1 To 10
ComboBox1.Items.Add("添加项:" & i)
ComboBox2.Items.Add("添加项:" & i)
Next
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox2.SelectedIndex = ComboBox1.SelectedIndex
End Sub
直接赋值: ComboBox1.Text = "123"
======================
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i = 1 To 10
ComboBox1.Items.Add("添加项:" & i)
ComboBox2.Items.Add("添加项:" & i)
Next
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox2.SelectedIndex = ComboBox1.SelectedIndex
End Sub
展开全部
添加项: ComboBox1.Items.Add("123")
ComboBox2.Items.Add("123")
查看: ComboBox2.SelectedItem="123"
ComboBox2.Items.Add("123")
查看: ComboBox2.SelectedItem="123"
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
通过combobox1的改变事件onchangeselected()改变bombobox2的值
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询