|
|
Title | Define tabs in a ListBox in Visual Basic .NET |
Description | This example shows how to define tabs in a ListBox in Visual Basic .NET |
Keywords | tab, ListBox, set tabs, defined tabs, VB.NET |
Categories | Controls, VB.NET |
|
|
Subroutine SetListBoxTabs defines tabs for a ListBox. It makes a "pinned" array (an array that cannot be moved by Visual Basic) if integers defining the tabs. It uses the SendMessage API function to send the ListBox the LB_SETTABSTOPS message passing it the array. It finishes by freeing the array and refreshing the ListBox.
|
|
Private Sub SetListBoxTabs(ByVal list_box As ListBox, ByVal _
tab_stops() As Integer)
Dim pinned_array As GCHandle = _
GCHandle.Alloc(tab_stops, GCHandleType.Pinned)
SendMessage( _
list_box.Handle, _
LB_SETTABSTOPS, _
New IntPtr(tab_stops.Length), _
pinned_array.AddrOfPinnedObject)
pinned_array.Free()
list_box.Refresh()
End Sub
|
|
|
|
|
|