Prev: Compile Error: Object Library invalid or contains references to object definitions that could not be found.
Next: How to scroll mouse wheel in flexgrid using VB6.0
From: Milo on 18 Feb 2005 06:10 I am trying to sort my flexgrid.......here is my code: flxHistory.Sort = flexSortGenericDescending I have in column 0 a date (dd/mm/yyyy) and column 1 a time (hh:mm:ss) I want to sort latest at top but it isnt working!!! It is sorting by date fine, the time column not so well though. It sorts by hour fine but the minutes are all over the place! Look here to get a better view: http://www.freenetpages.co.uk/hp/milo/flex.jpg -- Many Regards, Milo
From: Charles Krug on 18 Feb 2005 09:23 On Fri, 18 Feb 2005 11:10:18 +0000, Milo <Milo@[> wrote: > I am trying to sort my flexgrid.......here is my code: > > flxHistory.Sort = flexSortGenericDescending > > I have in column 0 a date (dd/mm/yyyy) and column 1 a time (hh:mm:ss) > > I want to sort latest at top but it isnt working!!! It is sorting by date fine, the time column not so well though. It sorts by hour fine but the minutes are all over the place! Look here to get a better view: > > http://www.freenetpages.co.uk/hp/milo/flex.jpg > What's the source of your data? If you're getting records from a database, you can use an Order By clause, and simply insert the records in the order they appear.. If memory serves, a flexgrid uses lexical ordering, which might not work as you expect for nonstring values.
From: Milo on 18 Feb 2005 09:37 I have the data in a msaccess database and am inporting it via ado Many Regards, Milo Charles Krug wrote: > On Fri, 18 Feb 2005 11:10:18 +0000, Milo <Milo@[> wrote: > >>I am trying to sort my flexgrid.......here is my code: >> >> flxHistory.Sort = flexSortGenericDescending >> >>I have in column 0 a date (dd/mm/yyyy) and column 1 a time (hh:mm:ss) >> >>I want to sort latest at top but it isnt working!!! It is sorting by date fine, the time column not so well though. It sorts by hour fine but the minutes are all over the place! Look here to get a better view: >> >>http://www.freenetpages.co.uk/hp/milo/flex.jpg >> > > > What's the source of your data? If you're getting records from a > database, you can use an Order By clause, and simply insert the records > in the order they appear.. > > If memory serves, a flexgrid uses lexical ordering, which might not work > as you expect for nonstring values. >
From: mscir on 18 Feb 2005 21:56 Milo wrote: > I am trying to sort my flexgrid.......here is my code: > flxHistory.Sort = flexSortGenericDescending > > I have in column 0 a date (dd/mm/yyyy) and column 1 a time (hh:mm:ss) > > I want to sort latest at top but it isnt working!!! It is sorting by > date fine, the time column not so well though. It sorts by hour fine > but the minutes are all over the place! Look here to get a better view: > > http://www.freenetpages.co.uk/hp/milo/flex.jpg There may be an advantage to allowing the user to sort the grid by clicking on the columns. If so: http://www.vb-helper.com/howto_sort_flexgrid.html I use this to sort a FlexGrid (in the Flexgrid click event): it uses an array to keep track of which direction the last sort performed on each column was, so subsequent clicks on the same column title will reverse the sort order of that column. The array is initialized to a value not equal to flexSortGenericAscending or flexSortGenericDescending. If GridRow = 0 Then 'user clicked on column title row 'sort grid on clicked column asc/desc based on array contents .col = col .Redraw = False If LastSort(col) = flexSortGenericAscending Then 'last sort on this col was ascending 'update array w/ new sort direction LastSort(col) = flexSortGenericDescending .Sort = flexSortGenericDescending Else 'last sort on this col was descending 'update array w/ new sort direction LastSort(col) = flexSortGenericAscending Sort = flexSortGenericAscending End If .Redraw = True End If
From: mscir on 19 Feb 2005 00:04
> Milo wrote: > >> I am trying to sort my flexgrid.......here is my code: >> flxHistory.Sort = flexSortGenericDescending >> >> I have in column 0 a date (dd/mm/yyyy) and column 1 a time (hh:mm:ss) >> >> I want to sort latest at top but it isnt working!!! It is sorting by >> date fine, the time column not so well though. It sorts by hour fine >> but the minutes are all over the place! Look here to get a better view: >> >> http://www.freenetpages.co.uk/hp/milo/flex.jpg Sorry, I didn't read your message through before posting useless information. |