Populating listbox with only one data

  • Thread starter Thread starter axwack
  • Start date Start date
A

axwack

I have to listbox controls. This form allows you to move data from one
listbox to the other


ListBox ADDBUTTON -> Listbox2

If you can imagine the above when you hit the ADDBUTTON it should move
one of the rows from the left listbox to the right one. I just want
one piece of data to move over . Is there a parameter to do this?
 
This is the event handler for AddButton upon click:

Private Sub AddButton_Click()
If ListBox1.ListIndex = -1 Then Exit Sub
For i = 0 to ListBox2.ListCount - 1
If ListBox1.Value = ListBox2.List(i) Then
Exit Sub
End If
Next i
ListBox2.AddItem ListBox1.Value
End Sub
 

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

Back
Top