|
-
Feb 1st, 2000, 09:14 PM
#1
Thread Starter
New Member
Im using listbox (style "Checked")[BR]
How can I remove items from the list? I need to remove the checked items from the list.[BR]
I have a command button in the form. What code do I need to enter to the command button so that it removes the selected item(s) from the list?[BR]
Thank you!
-
Feb 1st, 2000, 09:41 PM
#2
Hyperactive Member
The easiest way may be to clear the list box and reenter the list with just those items.
listbox.clear I believe will clear it.
If you know the items, then just put em back in if they get loaded from something else then before clearing:
dim strItems() as string, intI as integer
dim intItems as integer
intItems = listbox.listcount
redim strItems(intItems)
for inti = 1 to intItems
stritems(inti) = listbox.ItemData(inti)
next inti
'now you have all the items, you could put if statement in the loop to skip certain items.
dim intJ as integer
redim strItems(intItems - number of items you are removing)
intJ = 1
for inti = 1 to intItems
if listbox.itemdata(inti) <> "Cleared item" then
stritems(intj) = listbox.ItemData(inti)
intJ = intJ +1
end if
next inti
Hope this helps.
-
Feb 1st, 2000, 10:07 PM
#3
Frenzied Member
-
Feb 1st, 2000, 10:20 PM
#4
Lively Member
This code will check all your items in the list and remove only the ones that are selected.
Code:
Dim i As Integer
Dim intMaxItems As Integer
intMaxItems = List1.ListCount - 1
i = 0
Do While i <= intMaxItems
MsgBox List1.List(i)
If List1.Selected(i) = True Then
List1.RemoveItem i
intMaxItems = intMaxItems - 1
Else
i = i + 1
End If
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|