Hi Dag, this might be what you are after or point you in the right
direction. Just paste it into your application with the two listboxes
(ListBox1 and ListBox2) on the form.
Happy to help
Colin
Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListBox1.DoubleClick
ListBox2.Items.AddRange(ListBox1.Items())
ListBox1.Items.Clear()
End Sub
Private Sub ListBox2_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles ListBox2.DoubleClick
Dim answer As MsgBoxResult = MsgBox("Answer 'Yes' to clear listbox 2
or 'No' to transfer content from listbox 2 to listbox 1",
MsgBoxStyle.YesNoCancel, "Transfer or Clear")
If answer = MsgBoxResult.Yes Then
ListBox2.Items.Clear()
Else
ListBox1.Items.AddRange(ListBox2.Items())
ListBox2.Items.Clear()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
ListBox2.Items.Clear()
ListBox1.Items.Clear()
ListBox1.Items.Add("John")
ListBox1.Items.Add("Ringo")
ListBox1.Items.Add("Paul")
ListBox1.Items.Add("George")
End Sub
"Dag" <mr**********@hotmail.com> wrote in message
news:00****************************@phx.gbl...
Hello there! I have a problem here. For many of you it
would not be a problem at all, but I am new in
programming...so here is the question:
I have a form with two listboxes in it....Listbox1 and
Listbox2. Listbox1 contains some names and listbox2
contains nothing. if I doubleclick Listbox1 all names in
that listbox will be transferred to listbox2 (Listbox1
will now be empty and Listbox2 filled)...the next thing
is...Solution 1: if I doubleclick listbox2 all the names
will be deleted...or solution 2: all the names will be
transferred back again....
Thanx in advance
DG, Norway