Auto-adjust Column Width of a Listview Control in VB6
The following function auto adjusts column width of listview controls in vb6. Just copy and paste the code below on your project and call the function after loading data on your listview control.
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 Private Sub AutosizeColumns(ByVal TargetListView As ListView) Const SET_COLUMN_WIDTH As Long = 4126 Const AUTOSIZE_USEHEADER As Long = -2 Dim lngColumn As Long For lngColumn = 0 To (TargetListView.ColumnHeaders.Count - 1) Call SendMessage(TargetListView.hwnd, SET_COLUMN_WIDTH, lngColumn, ByVal AUTOSIZE_USEHEADER) Next lngColumn End Sub
Add and customize ListView columns
ReplyDeletethanks for this code
ReplyDeletecode to sort/group data in listview by number of delimiter/s . e.g.1,2,3;2,4,6,8;3,6,9,12....
ReplyDeletecode to sort/group data in listview by number of delimiter/s . e.g.1,2,3;2,4,6,8;3,6,9,12....group by semicolon(;)
ReplyDelete