|
-
Mar 29th, 2007, 02:04 AM
#1
Thread Starter
Junior Member
Help with removing post from a ListBox (VB6)
Hi,
I have a project in VB6 where I have a ListBox (lstCombo). I wish to be able to add and remove 4-char long combinations in this ListBox.
I have a CommandButton (cmdAdd) that looks like this:
----------------------------------------
'Add a combination to the list.
Private Sub cmdAdd_Click()
Dim strToAdd As String
strToAdd = InputBox("Combination to include: ", "Enter Combination")
If Len(Trim$(strToAdd)) > 0 Then
If Not ListItemExists(strToAdd) Then
lstCombo.AddItem strToAdd
End If
End If
End Sub
----------------------------------------
I also have a CommandButton (cmdRemove) that I will be able to remove posts with, but I does not manage to get this to work. My (not so good) try looked like this:
----------------------------------------
'Remove a combination from the list.
Private Sub cmdRemove_Click()
Dim strToRemove As String
strToRemove = InputBox("Combination to remove: ", "Enter Combination")
If Len(Trim$(strToRemove)) > 0 Then
If ListItemExists(strToRemove) Then
lstCombo.RemoveItem strToRemove
End If
End If
End Sub
----------------------------------------
Can you maybe instead do so you click and mark one post and then click “remove”?
I Would also like to have a CommandButton (cmdRemoveAll) that completely clears the ListBox.
If anyone has any good ideas on how to solve this in a good way, I would be very thankful!
/M
Last edited by mats_1; Mar 29th, 2007 at 02:32 AM.
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
|