Bry Man
12-21-2004, 02:53 AM
Hey, sorry for the title, I wasnt sure how long It could be and what I wasnt completely sure how to ask my question so Ill restate it here.
I found a script on the net that supposedly lets you remove a selected item in a list box by selecting it and hitting a button. The only thing is I cant seem to get it to work I tried drawing out a list box and naming is ListView1 but that isnt right, can anyone help me figure out how im supposed to name the objects to make this work?
Private Sub Form_Load()
ListView1.ListItems.Add , , "TEST"
ListView1.ListItems.Add , , "TEST2"
End Sub
Private Sub cmdButton_Click()
Dim item As ListItem
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
If (ListView1.ListItems(i).Selected) Then
ListView1.ListItems.Remove (i)
Exit For
End If
Next i
End Sub
I found a script on the net that supposedly lets you remove a selected item in a list box by selecting it and hitting a button. The only thing is I cant seem to get it to work I tried drawing out a list box and naming is ListView1 but that isnt right, can anyone help me figure out how im supposed to name the objects to make this work?
Private Sub Form_Load()
ListView1.ListItems.Add , , "TEST"
ListView1.ListItems.Add , , "TEST2"
End Sub
Private Sub cmdButton_Click()
Dim item As ListItem
Dim i As Integer
For i = 1 To ListView1.ListItems.Count
If (ListView1.ListItems(i).Selected) Then
ListView1.ListItems.Remove (i)
Exit For
End If
Next i
End Sub