views:

66

answers:

0

I am trying to set tab stops in a CheckedListBox in my WinForms application, but no matter what I do, it does not seem to have any effect. I have the following in the code for my form:

<DllImport("user32.dll")> _
Public Sub SendMessage(ByVal hWnd As IntPtr, ByVal uMsg As Int32, ByVal wParam As Int32, ByRef lParam As Int32)
End Sub

Public Const LB_SETTABSTOPS As Int32 = &H192

And in the form's load method, I am doing the following, where theList is my CheckedListBox:

Dim tabStops() As Integer = {40, 140, 240}
Call SendMessage(theList.Handle, LB_SETTABSTOPS, tabStops.Length, tabStops(0))
theList.Refresh()

And then later on, I use this in a loop, where col1 through col4 are all string values for the columns:

theList.Items.Add(col1 & vbTab & col2 & vbTab & col3 & vbTab & col4)

But no matter what I use for the values of tabStops, the list is formatted with standard width tab stops.