Basic Problem with a listbox control

  • Thread starter Thread starter Gunnu
  • Start date Start date
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
 
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.
 
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.
 
Back
Top