Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For i As Integer = 0 To 4
ListBox1.Items.Add("Elemento " & i)
Next
End Sub
Private Sub btnEliminar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEliminar.Click
If Not ListBox1.SelectedIndex = -1 Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
If Not ListBox2.SelectedIndex = -1 Then
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
End If
End Sub
Private Sub btnPasar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPasar.Click
If Not ListBox1.SelectedIndex = -1 Then
Dim temp As String = ListBox1.SelectedItem.ToString
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
ListBox2.Items.Add(temp)
End If
If Not ListBox2.SelectedIndex = -1 Then
Dim temp As String = ListBox2.SelectedItem.ToString
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
ListBox1.Items.Add(temp)
End If
End Sub
End Class