求助:关于组合框的小问题
现有如下图所示的两个组合框,想实现以下功能,应该如何编写代码呢?请各位大侠指教。combo1.additem "水果"
combo1.additem "蔬菜"
当选中combo1中的“水果”时,combo2中会有“苹果”、“梨”等选项供选择;
当选中combo1中的“蔬菜”时,combo2中会有“白菜”、“萝卜”等选项供选择。
Private Sub Form_Load() Combo1.AddItem "水果" Combo1.ItemData(Combo1.NewIndex) = 1 Combo1.AddItem "蔬菜" Combo1.ItemData(Combo1.NewIndex) = 2 Combo1.ListIndex = 0 End Sub Private Sub Combo1_Click() Combo2.Clear Select Case Combo1.ItemData(Combo1.ListIndex) Case 1 Combo2.AddItem "苹果" Combo2.AddItem "梨" Combo2.ListIndex = 0 Case 2 Combo2.AddItem "白菜" Combo2.AddItem "萝卜" Combo2.ListIndex = 0 End Select End Sub