CODE
Form1
Private Sub Add1_Click()
Dim listitem As String
listitem = InputBox("Enter item to add to the list")
If Trim(listitem) <> "" Then
List1.AddItem listitem
End If
End Sub
Private Sub Add2_Click()
Dim listitem As String
listitem = InputBox("Enter item to add to the list")
If Trim(listitem) <> "" Then
List2.AddItem listitrem
End If
End Sub
Private Sub Backward_Click()
Dim i As Integer
For i = List2.ListCount - 1 To 0 Step -1
If List2.Selected(i) Then
List1.AddItem List2.List(i)
List2.RemoveItem i
End If
Next i
End Sub
Private Sub Clear1_Click()
List1.Clear
End Sub
Private Sub Forward_Click()
Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List2.AddItem List1.List(i)
List1.RemoveItem i
End If
Next i
End Sub
Private Sub Remove1_Click()
Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
If List1.Selected(i) Then
List1.RemoveItem i
End If
Next i
End Sub
Private Sub SelectAll1_Click()
Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
List1.Selected(i) = True
Next i
End Sub
Private Sub SelectAll2_Click()
Dim i As Integer
For i = List2.ListCount - 1 To 0 Step -1
List2.Selected(i) = True
Next i
End Sub
Monday, June 14, 2010
LISTBOX SORTING
AIM:To sort a list of items using listbox
0 comments:
Post a Comment