Yes, that's what i mean..
So it's like this, right?
It still won't work though...the comboboxes won't show the items.Code:Option Explicit '----------------------------------------------------------------------------- Private Sub Form_Load() '----------------------------------------------------------------------------- Dim objLI As ListItem Dim lngX As Long ' Set up LV columns: 4 columns, each 1/4 the width of the LV With ListView1.ColumnHeaders .Add , , "A", ListView1.Width \ 4 .Add , , "B", ListView1.Width \ 4 .Add , , "C", ListView1.Width \ 4 .Add , , "D", ListView1.Width \ 4 End With ' populate 20 rows of the 4 columns with random numbers from 1 to 100 ' format the numbers using "@@@@" meaning right-justify and space-fill ' this formatting will ensure proper numeric sorting (because the LV only does ' character-based sorts ... Set objLI = ListView1.ListItems.Add(, , Format$(1, "@@@@")) objLI.SubItems(1) = Format$(3, "@@@@") objLI.SubItems(2) = Format$(2, "@@@@") objLI.SubItems(3) = Format$(2, "@@@@") Set objLI = ListView1.ListItems.Add(, , Format$(10, "@@@@")) objLI.SubItems(1) = Format$(31, "@@@@") objLI.SubItems(2) = Format$(12, "@@@@") objLI.SubItems(3) = Format$(12, "@@@@") Set objLI = ListView1.ListItems.Add(, , Format$(4, "@@@@")) objLI.SubItems(1) = Format$(6, "@@@@") objLI.SubItems(2) = Format$(3, "@@@@") objLI.SubItems(3) = Format$(7, "@@@@") Combo1.AddItem "A" Combo1.AddItem "B" Combo1.AddItem "C" Combo2.AddItem "1" Combo2.AddItem "2" Combo2.AddItem "3" Combo3.AddItem "X" Combo3.AddItem "Y" Combo3.AddItem "Z" End Sub '----------------------------------------------------------------------------- Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader) '----------------------------------------------------------------------------- Dim objCH As ColumnHeader With ListView1 If (.Sorted) And (ColumnHeader.SubItemIndex = .SortKey) Then If .SortOrder = lvwAscending Then .SortOrder = lvwDescending Else .SortOrder = lvwAscending End If Else .Sorted = True .SortKey = ColumnHeader.SubItemIndex .SortOrder = lvwAscending End If ' Let's get fancy and show an up/down arrow in the column header ' indicating the sort direction ... For Each objCH In .ColumnHeaders If objCH.Index = ColumnHeader.Index Then .ColumnHeaders(objCH.Index).Icon _ = IIf(.SortOrder = lvwAscending, "Up", "Down") Else .ColumnHeaders(objCH.Index).Icon = 0 End If Next .Refresh End With End Sub Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem) With ListView1.SelectedItem If .Text = "1" And .SubItems(1) = "3" And .SubItems(2) = "2" And .SubItems(3) = "2" Then Combo1.ListIndex = 0 Combo2.ListIndex = 2 Combo3.ListIndex = 1 ElseIf .Text = "10" And .SubItems(1) = "31" And .SubItems(2) = "12" And .SubItems(3) = "12" Then Combo1.ListIndex = 1 Combo2.ListIndex = 1 Combo3.ListIndex = 0 ElseIf .Text = "4" And .SubItems(1) = "6" And .SubItems(2) = "3" And .SubItems(3) = "7" Then Combo1.ListIndex = 2 Combo2.ListIndex = 0 Combo3.ListIndex = 2 End If End With End Sub
I've tried changing the method into select case and it won't work too...what could be wrong huh?




Reply With Quote