Basic Problem with a listbox control

G

Gunnu

Hello,

I am having a problem with 2 listboxes on a form. there are 5 items in
the 1st listbox and if i click the first item i want a value to show
up in the second listbox . This is working fine, but if i click it
again, that value shows up again in the second listbox underneath the
'o' index. how do i stop this?

this is the code:

If packageListBox.SelectedIndex = 0 Then
interiorListBox.Items.Insert(0, "Fragrance")
End If

thanks for ur help
Bharath
 
G

Guest

Hello,

I am having a problem with 2 listboxes on a form. there are 5 items in
the 1st listbox and if i click the first item i want a value to show
up in the second listbox . This is working fine, but if i click it
again, that value shows up again in the second listbox underneath the
'o' index. how do i stop this?

this is the code:

If packageListBox.SelectedIndex = 0 Then
interiorListBox.Items.Insert(0, "Fragrance")
End If


Clear the lsit prior to inserting the new item.
 
D

Dave Griffiths

Maybe write a little code to check for the existance of the entry in List2
before it is added to the list. If it exists then don't add it again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top