for i=1900 to 2010
combobox1.additem(cstr(i))
next
相关知识:
Cstr函数是将数字转化为字符串
添加项: 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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)