[RESOLVED] Listview, refresh or remove
How can i prevent entering the same data in a listview control.
I have a listbox with different names. Depending on the name
selected all types of data will fill the listview control with columns... .e.g
address, work number, emplyee id etc... this works fine
The problem is when I select a different name, the first selection stays in the listview along with the new selection or if I select the same name it adds it again. is there a way to refresh or remove the first choice
THanks in advance!@
Re: Listview, refresh or remove
You can use FindItem method:
Code:
Private Sub Command2_Click()
Dim i As Integer
ListView1.ListItems.Clear
For i = 1 To 10
ListView1.ListItems.Add , , "Item" & i
Next i
If ListView1.FindItem("Item1") Is Nothing Then
ListView1.ListItems.Add , , "Item1"
Else
MsgBox "Item1 already exists." '<<< you shoud get the msgbox
End If
End Sub
Re: Listview, refresh or remove
Thanks RhinoBull that worked fine.:wave:
Re: [RESOLVED] Listview, refresh or remove