LB_SETTABSTOPS does not appear to affect a CheckedListBox

Posted by BP on Stack Overflow See other posts from Stack Overflow or by BP
Published on 2010-04-12T15:50:12Z Indexed on 2010/04/12 15:53 UTC
Read the original article Hit count: 383

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.

© Stack Overflow or respective owner

Related posts about winforms

Related posts about vb.net