我需要在1个组合框中选择的项目将在另一个组合框中显示此选择中的未决项目。我不在项目中使用SQL,EXEL,ACCESS或VBA。我在winforms中添加了自己的项目。它应该看起来像这样的声音: http://imgur.com/BYQNVzd 非常感谢您的帮助。
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex = 0 Then
' Index 0 is BMW
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange({"X5", "X6", "7-series", "5-series", "3-series"})
ElseIf ComboBox1.SelectedIndex = 1 Then
' Toyota
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange({"Teana", "Camry"})
ElseIf ComboBox1.SelectedIndex = 2 Then
' kia
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange({"Rio"})
End If
End Sub
答案 0 :(得分:0)
看起来像这样
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
If ComboBox1.SelectedIndex = 0 Then
' Index 0 is BMW
ComboBox2.Items.Clear()
ComboBox2.Items.AddRange({"X5", "X6", "7-series", "5-series", "3-series"})
ElseIf ComboBox1.SelectedIndex = 1 Then
' Toyota
End If
End Sub