Sorted a listview on header click 
Author Message
 Sorted a listview on header click
Hi,

I would like to know if there is already an existing property , function or
sub that sort the listitems of a listview when we click on a header? Do we
have to code it ourself?

Thanks
Zoury



Sat, 24 Jul 2004 22:39:26 GMT  
 Sorted a listview on header click
This is great:

http://www.freevbcode.com/ShowCode.Asp?ID=484

This is not so great but more basic:

http://www.freevbcode.com/ShowCode.Asp?ID=480


Quote:
> Hi,

> I would like to know if there is already an existing property , function
or
> sub that sort the listitems of a listview when we click on a header? Do we
> have to code it ourself?

> Thanks
> Zoury



Sat, 24 Jul 2004 23:38:46 GMT  
 Sorted a listview on header click


Quote:
> Hi,

> I would like to know if there is already an existing property , function
or
> sub that sort the listitems of a listview when we click on a header? Do we
> have to code it ourself?

> Thanks
> Zoury

Look up the ListView's Sorted, SortKey, and SortOrder properties in VB's
Help.

Mike



Sat, 24 Jul 2004 23:42:11 GMT  
 Sorted a listview on header click
that's great! thanks

Zoury


Quote:
> This is great:

> http://www.freevbcode.com/ShowCode.Asp?ID=484

> This is not so great but more basic:

> http://www.freevbcode.com/ShowCode.Asp?ID=480



> > Hi,

> > I would like to know if there is already an existing property , function
> or
> > sub that sort the listitems of a listview when we click on a header? Do
we
> > have to code it ourself?

> > Thanks
> > Zoury



Sun, 25 Jul 2004 03:42:11 GMT  
 Sorted a listview on header click
Thanks Mike!

My friend didn't see those properties (he's shy now ;-) )

Zoury


Quote:



> > Hi,

> > I would like to know if there is already an existing property , function
> or
> > sub that sort the listitems of a listview when we click on a header? Do
we
> > have to code it ourself?

> > Thanks
> > Zoury

> Look up the ListView's Sorted, SortKey, and SortOrder properties in VB's
> Help.

> Mike



Sun, 25 Jul 2004 03:43:55 GMT  
 Sorted a listview on header click
Private Sub ListView1_ColumnClick(ByVal ColumnHeader As
MSComctlLib.ColumnHeader)

  '/* Sort listview based on columnheader clicked

   With ListView1
      .SortKey = ColumnHeader.Index - 1    '/* key is 0-based, whereas
columnheader is 1 based.
      .SortOrder = Abs(Not .SortOrder = 1) '/* this toggles
ascending/descending sorts
      .Sorted = True                       '/* performs the sort
   End With

  '/* if user wanted to keep the selected
  '/* item in view when sorted, do so!
   If bKeepVisible Then
      If Not ListView1.SelectedItem Is Nothing Then

ListView1.ListItems.Item(ListView1.SelectedItem.Index).EnsureVisible
      End If
   End If

End Sub

--

Randy Birch
MVP Visual Basic

http://www.mvps.org/vbnet/

Please respond only to the newsgroups so all can benefit.


Quote:
> Hi,

> I would like to know if there is already an existing property , function
or
> sub that sort the listitems of a listview when we click on a header? Do we
> have to code it ourself?

> Thanks
> Zoury



Sun, 25 Jul 2004 07:07:01 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. sort a listview by column header click

2. Sorting the content of list view on clicking column headers

3. ? 3014 Can't open any more tables - Click header to sort by column fails

4. List View click on header to sort date column

5. List View - Sort by Clicking Header

6. DBGrid Sorting by Clicking on the Header Row

7. How to sort on a listview column header?

8. sort ListView by date and time by pressing the column header

9. ListView: column header sort mark

10. right click in listview headers

11. Right Mouse Click on a Listview header?

12. Right Click on Listview Column Headers

 

 
Powered by phpBB® Forum Software