Senin, 09 Februari 2009

The ListIndex Property of the ListBox 4

Here’s the code for the ‘movetoleft’ command button ….

Private Sub cmdMoveToLeft_Click()

Dim i As Integer

If List2.ListIndex = -1 Then Exit Sub

For i = List2.ListCount - 1 To 0 Step -1

If List2.Selected(i) = True Then

List1.AddItem List2.List(i)

List2.RemoveItem i

End If

Next i

End Sub

By the way, we’ve covered just about every ListBox method there is—in case you’re curious, if you wanted to remove every item from the ListBox at one time, just use the CLEAR method of the ListBox, like this…

List1.Clear

Summary

Working with MultiSelect ListBoxes is much more complex than the default Single Select ListBox. But the benefits far outweigh the complexity, as you permit the user of your program much greater flexibility.

Next Month

Creating a Toolbar in your Visual Basic program.


source: http://www.vbexplorer.com/VBExplorer/VBExplorer.asp

------------------------------------------


Related:


single-record
Trik Cara Melacak IP
Trik Choose Phone
Trik woodwork-stores
Trik woodwork supplies
Trik wood work tool
Using radio button vb2008
Valentineday
vb2008 with control
vb2008 with control properties
vb2008 with oriented programming
VB.NET Solution files
VB.NET Code myclass