我不确定您的问题,部分原因是您没有发布代码让我在您的情况下为您提供帮助。这是我为您完成的示例。这是一个快速的,但有效;您实际上可以在一个过程中完成此操作,但这样做是为了了解其工作原理。
Public Class Form1
'Always give variable a default value'
Private selectedIndex As Integer = 0
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Dim myArray() As String = {"1", "2", "3"}
ComboBox1.Items.AddRange(myArray)
ComboBox2.Items.AddRange(myArray)
ComboBox3.Items.AddRange(myArray)
End Sub
'Handles one of your comboboxes'
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
'Cast this as Integer for selected index and set your variable'
selectedIndex = CType(ComboBox1.SelectedIndex.ToString, Integer)
'Next lets make sure that we set the other comboboxes to this index'
ComboBox2.SelectedIndex = selectedIndex
ComboBox3.SelectedIndex = selectedIndex
End Sub
'Another one of your comboboxes'
Private Sub ComboBox2_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
'Cast this as Integer for selected index and set your variable'
selectedIndex = CType(ComboBox2.SelectedIndex.ToString, Integer)
'Next lets make sure that we set the other comboboxes to this index'
ComboBox1.SelectedIndex = selectedIndex
ComboBox3.SelectedIndex = selectedIndex
End Sub
'Your last combobox'
Private Sub ComboBox3_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
'Cast this as Integer for selected index and set your variable'
selectedIndex = CType(ComboBox3.SelectedIndex.ToString, Integer)
'Next lets make sure that we set the other comboboxes to this index'
ComboBox1.SelectedIndex = selectedIndex
ComboBox2.SelectedIndex = selectedIndex
End Sub
End Class
*您必须将全局变量添加到顶部,以便它可以用于保存当前组合框选定的索引。您也可以忽略加载事件,因为我将其用作参考。
谢谢!