This is the design of this project…
We need 8 Command Buttons
2 Listbox
So Here Code Begin
Public Class Form1
Dim tmp As String
Private Sub Button7_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button7.Click
tmp = InputBox("Enter the item name to add", "Insertion")
If Len(tmp.Trim) > 1 Then
Me.ListBox1.Items.Add(tmp)
Else
MsgBox("Value can not be NULL")
End If
tmp = ""
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button8.Click
tmp = InputBox("Enter the item name to add", "Insertion")
If Len(tmp.Trim) > 1 Then
Me.ListBox2.Items.Add(tmp)
Else
MsgBox("Value can not be NULL")
End If
tmp = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
If Me.ListBox1.SelectedIndex >= 0 Then
Me.ListBox2.Items.Add(Me.ListBox1.SelectedItem)
Else
MsgBox("First Select an item from left side!")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
If Me.ListBox2.SelectedIndex >= 0 Then
Me.ListBox1.Items.Add(Me.ListBox2.SelectedItem)
Else
MsgBox("First Select an item from right side!")
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
Dim i As Integer
For i = 0 To Me.ListBox1.Items.Count - 1
Me.ListBox2.Items.Add(Me.ListBox1.Items.Item(i))
Next
Me.ListBox1.Items.Clear()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
Dim i As Integer
For i = 0 To Me.ListBox2.Items.Count - 1
Me.ListBox1.Items.Add(Me.ListBox2.Items.Item(i))
Next
Me.ListBox2.Items.Clear()
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button6.Click
If Me.ListBox1.SelectedIndex >= 0 Then
Me.ListBox1.Items.RemoveAt(Me.ListBox1.SelectedIndex)
Else
MsgBox("First Select an item from left side!")
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button5.Click
If Me.ListBox2.SelectedIndex >= 0 Then
Me.ListBox2.Items.RemoveAt(Me.ListBox2.SelectedIndex)
Else
MsgBox("First Select an item from right side!")
End If
End Sub
End Class
Illustration : Coming Soon. (Required a reply…)
Download this project : Link
Hey if you need illustration then leave a comment.