LNumCols = UBound(alColWidths) - LBound(alColWidths) + 1Ĭall SendMessage(lbListbox.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)Ĭall SendMessage(lbListbox.hwnd, LB_SETTABSTOPS, lNumCols, alColWidths(0))ĭebug.Print "Error in ListboxSetTabStops: " & Err. Public Function ListboxSetTabStops(lbListbox As ListBox, alColWidths() As Long, Optional lNumCols As Long = -1) As BooleanĬonst LB_SETTABSTOPS = &H192, WM_PAINT = &HF ' ListboxSetTabStops Me.List1, alColWidths ' lSumColWidths = lSumColWidths + alColWidths(lThisCol) ' alColWidths(lThisCol) = lSumColWidths + clM圜olTabWidth 'Tab stops are cummulative ' For lThisCol = 1 To UBound(alColWidths) ' Dim lThisCol As Long, lSumColWidths As Long ' Example: For a listbox with three columns use equally spaced at 30 chars Me.List1.AddItem "Column1" & vbTab & "Column2" 'Notes : When adding data to the listbox you must delimit your columns with 'Outputs : Returns True on success, else returns False. ' additional columns may be painted over. ' If this is less than the number of columns visible, the If you just want to display the content of the file go for a rich text box control. But if u want to displat tthe content of text file in a control, rich textbox control would be a better option for you. ' The number of columns to alter the tab positions of. Read the file line by line and add it to the listbox using ADDITEM method. Editor is not available with the Visual Studio Shell. ' alColWidths A zero based one dimension array of longs containing For more information, see the Intel Visual Fortran Compiler. 'Inputs : lbListbox The listbox to set the tab positions 'Purpose : Sets the tab positions in a listbox Private Declare Function PostMessage Lib "user32.dll" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long To set the tab positions of a listbox use the following code:
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |