I am doing a ListBox project
here is the example:
[img]http://i213.photobucket.com/albums/cc8/n9370/a4htm7.jpg[/img]

I almost down this project. but i still have somewhere need your help.
When i double click an item on toplist, i will move the item to the bottom list
For example, when i double click Acer, it will be to the bottom list.
which do the same thing when i click the button "move to bottom list"
i know how to write the code for that button,
here is my code for that

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim i As Integer
        For i = ListBox1.Items.Count - 1 To 0 Step -1
            If ListBox1.GetSelected(i) = True Then  
                ListBox2.Items.Add(ListBox1.Items(i).ToString)  
                ListBox1.Items.RemoveAt(i)    
            End If
        Next

    End Sub

but i don't know how to write for the selected item on double clicking. how do i write this?

Another problem i have is that
my testbox should be enabled only when any text present in the text box
how do i fix my code to do it? thank you.

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        If TextBox1.Text = "" Then
            Button3.Enabled = False
        End If

    End Sub

The same as the button.

Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
        Dim i As Integer
        For i = ListBox1.Items.Count - 1 To 0 Step -1
            If ListBox1.GetSelected(i) = True Then
                ListBox2.Items.Add(ListBox1.Items(i).ToString)
                ListBox1.Items.RemoveAt(i)
            End If
        Next
    End Sub

However it does not act as you would think. By selecting more than one object and double click, only the one doubleclicked on will be transfered. If you hold down the ctrl and doubleclick, all will be transfered but the one doubleclicked on. If you select several with the shift and holding down the shift then all selected will be transfered. If you make several random selections with the ctrl key and then hold down the shift and doubleclick then everything between the first selected and last selected will be transfered.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.