To Move Replace Listbox with content, which wants you need in specific words you can follow this step :
1. Make 2 Listbox (Default Name List1 and List2)
2. Make 1 Command Button (default name Command1) and add this code :
'Button Code
Private Sub Command1_Click()
MoveItems
End Sub
3. To make insert data to your listbox you can fill this code :
' data on the list1
Private Sub Form_Load()
List1.AddItem "book01"
List1.AddItem "book02"
List1.AddItem "book03"
List1.AddItem "book04"
List1.AddItem "book05"
List1.AddItem "apple"
List1.AddItem "mango"
List1.AddItem "pen"
List1.AddItem "ball"
List1.AddItem "packet1"
List1.AddItem "packet2"
List1.AddItem "packet3"
End Sub
4. Choose specific words wants you need fill this code :
Private Sub MoveItems()
Dim l As Long
List2.Clear
l = 0
Do While l < List1.ListCount If InStr(List1.List(l), "packet") <> 0 Then
MoveListItem l
ElseIf InStr(List1.List(l), "book") <> 0 Then
MoveListItem l
Else
l = l + 1
End If
Loop
End Sub
Private Sub MoveListItem(idx As Long)
List2.AddItem List1.List(idx)
List1.RemoveItem idx
End Sub
5. Finish ... after this try to run
this data what you want will be move to the List2 and data which you not need will be placed on List1
Good Luck May Be Helps
List1.AddItem "packet1"
List1.AddItem "packet2"
List1.AddItem "packet3"
End Sub
4. Choose specific words wants you need fill this code :
Private Sub MoveItems()
Dim l As Long
List2.Clear
l = 0
Do While l < List1.ListCount If InStr(List1.List(l), "packet") <> 0 Then
MoveListItem l
ElseIf InStr(List1.List(l), "book") <> 0 Then
MoveListItem l
Else
l = l + 1
End If
Loop
End Sub
Private Sub MoveListItem(idx As Long)
List2.AddItem List1.List(idx)
List1.RemoveItem idx
End Sub
5. Finish ... after this try to run
this data what you want will be move to the List2 and data which you not need will be placed on List1
Good Luck May Be Helps
0 comments:
Posting Komentar