Hi
I Must to read a string like ("850;830;801;819") and to check when in listview, when is equal others values,
I must to clean checkbox and to check with new values
How can I do it ?
tia
Printable View
Hi
I Must to read a string like ("850;830;801;819") and to check when in listview, when is equal others values,
I must to clean checkbox and to check with new values
How can I do it ?
tia
If you need to find item in your listview control try using FindItem method:
Code:Dim itm As MSComctlLib.ListItem
Set itm = ListView1.FindItem("whatever")
If Not itm Is Nothing Then
itm.Selected = True
' do something
Else
' do something else...
End If
Something like this?
Code:'~~> Adding Sample Data to Listview
Private Sub Command1_Click()
Dim column_header As ColumnHeader, list_item As ListItem
'~~> Create the column headers.
Set column_header = ListView1.ColumnHeaders.Add(, , "Number", 1000)
'~~> Start with report view.
ListView1.View = lvwReport
ListView1.Checkboxes = True
Set list_item = ListView1.ListItems.Add(, , "123")
Set list_item = ListView1.ListItems.Add(, , "456")
Set list_item = ListView1.ListItems.Add(, , "850")
Set list_item = ListView1.ListItems.Add(, , "801")
End Sub
'~~> Checking the relevant items....
Private Sub Command2_Click()
Dim ChkStrg As String, MyArray() As String
ChkStrg = "850;830;801;819"
MyArray = Split(ChkStrg, ";")
'~~> Clear All the Checks
For i = 1 To ListView1.ListItems.Count
ListView1.ListItems(i).Checked = False
Next i
For i = LBound(MyArray) To UBound(MyArray)
Dim lstItem As ListItem
Set lstItem = ListView1.FindItem(MyArray(i), lvwText, , lvwWholeWord)
If Not lstItem Is Nothing Then
lstItem.Checked = True
End If
Next i
End Sub