Author |
Message |
GlobeTrotter
|
Posted: Mon Mar 28, 2005 3:57 pm Post subject: Lists With Columns |
|
|
Is it possible to create a type of list with multiple columns, that can be dragged around, and stretched, and also sorted based on which title/top row you click on. Similar to this picture, taken from the task manager.
Description: |
|
Filesize: |
296.19 KB |
Viewed: |
3800 Time(s) |
|
Description: |
Picture of what I want to make in VB |
|
Filesize: |
296.19 KB |
Viewed: |
3797 Time(s) |
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Brightguy
|
Posted: Tue Mar 29, 2005 2:30 pm Post subject: Re: Lists With Columns |
|
|
Personally I've never used it, but you can do that with the ListView control in report view. (To use the control, add the component "Microsoft Windows Common Controls" into your project.)
I tried it out for a minute and got a test working. Although you have to write the sorting procedure yourself, in the ColumnClick event.
|
|
|
|
|
|
GlobeTrotter
|
Posted: Tue Mar 29, 2005 5:03 pm Post subject: (No subject) |
|
|
I can't seem to make it more than one column, or have the button at the top with the column title.
I tried this to add a column, but it didn't work.
code: |
lvTracks.ColumnHeaders.Add = "Test"
|
How did you get it working?
|
|
|
|
|
|
Brightguy
|
Posted: Wed Mar 30, 2005 6:57 pm Post subject: Re: Lists With Columns |
|
|
First you have to change the view property to lvwReport.
A lot of design time properties can be set in the "Custom" window. There actually is an option to automatically sort the items. (Which I overlooked.)
|
|
|
|
|
|
GlobeTrotter
|
Posted: Sun May 15, 2005 10:36 pm Post subject: (No subject) |
|
|
Okay, I've got a couple of problems. First of all, I can only deal with the first column. I can't seem to add to the other columns, or edit them because I don't know how. For example, if I just put lVW.ListItems.Add = "1" It will add a 1 to the first row/column, but how do I do the 2nd. My other question, I realized how to sort the things, but why won't this code work?
code: | Private Sub lvwTracks_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader)
lvwTracks.SortKey = ColumnHeader.Key
If lvwTracks.SortOrder = lvwAscending Then
lvwTracks.SortOrder = lvwDescending
Else
lvwTracks.SortOrder = lvlAscending
End If
End Sub |
|
|
|
|
|
|
Brightguy
|
Posted: Thu May 19, 2005 1:26 pm Post subject: Re: Lists With Columns |
|
|
Try this:
VisualBASIC: | lvwTracks.ListItems.Add.SubItems(1) = "2nd column" |
And:
VisualBASIC: | lvwTracks.SortKey = ColumnHeader.Index - 1 |
|
|
|
|
|
|
GlobeTrotter
|
Posted: Thu May 19, 2005 5:05 pm Post subject: (No subject) |
|
|
Thanks.
|
|
|
|
|
|
|