Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Listview


Reply
 
Thread Tools Display Modes
  #1  
Old 06-12-2001, 03:23 AM
master_huby
Guest
 
Posts: n/a
Default Listview


probably a dumb question : how do i get a listview to sort itself when a user clicks on one of the column headers ? ascending, then descending (like in microsoft outlook to view your mails alphabetically, or by recieved date, ...)

thanx

"windows is not a virus, because it doesn't work"
Reply With Quote
  #2  
Old 06-12-2001, 04:11 PM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,885
Default Re: Listview

First make sure that it is style is set to report:
<pre>
listview1.View = lvwReport
ListView1.Sorted = True
</pre>


*</p>
then in:
<pre>
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As MSComctlLib.ColumnHeader)
ListView1.SortKey = ColumnHeader.Key
End Sub
</pre>

Reply With Quote
  #3  
Old 06-13-2001, 07:09 AM
master_huby
Guest
 
Posts: n/a
Default Re: Listview

i did exactly that, but i get a type mismatch error. i see at runtime that the key value is "". anything else i should check for ?
by the way my columns are designed at runtime, so i should probably assign a key value then, but i'm not quite sure what it's supposed to be ...

"windows is not a virus, because it doesn't work"
Reply With Quote
  #4  
Old 06-14-2001, 05:22 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,885
Default Re: Listview

Just asign a key to every column you're adding.
eg.
"col1" for column 1
"col2" for column 2

etc

Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->