Jump to content

Removing items from ListBox

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
Well i have two list boxes and List1 is filled with a list of text and List2 with nothing... I want to make it so when i double click one of the items on List1 it disappears and it appears in List2. I already know how to make it appear in List2 by using this code:

Quote

Private Sub List1_DblClick()
List2.AddItem (List1.Text)
End Sub

But when i try to add this code to make the item disappear from List1 when it's double clicked:

Quote

List1.RemoveItem (List1.Text)

After adding the above code it would look like this altogether:

Quote

Private Sub List1_DblClick()
List1.RemoveItem (List1.Text)
List2.AddItem (List1.Text)
End Sub

When i press play it gives me an error! This is what it is:

Quote

Runtime Error: 13

Type mismatch.

Then i press DEBUG and it highlights this code in yellow:

Quote

List1.RemoveItem (List1.Text)

I don't even know what's wrong with this!

Anyone have any ideas?

I'm using VB 6.0.

Thanks.
[SIGPIC]C:\Users\Travis\Desktop\Image Converter\Knight1.bmp[/SIGPIC]

#2
travy92

travy92

    Learning Programmer

  • Members
  • PipPipPip
  • 76 posts
Don't worry guys i found the solution! This code:

Quote

List1.RemoveItem (List1.ListIndex)

Thanks anyway..
[SIGPIC]C:\Users\Travis\Desktop\Image Converter\Knight1.bmp[/SIGPIC]