|
-
Oct 5th, 2013, 02:39 PM
#1
Thread Starter
Member
Data Grid View won't sort rows by column DATE
Hi everyone, as the title says, I got a Data Grid View that I want it to be sorted by the date of a certain column, but I can't do it.
Explaining the problem:
The DataGridView sorts, okay, but it sorts by the first value of a date, not of the entire value of the date (at least that's what i think). For example I got a date:
05/10/13 with this format: dd/MM/yy. Correctly declared as DATE. And then If I add another row with another Date Value, like: 01/11/13, it sorts to the first position! (It couldn't because the month of the date is a later month!). If the date is in the same month it sorts right.
Im guessing it's sorting by the first value of the date, taken as a string.
What I've Done:
- Edited CellStyle to Date format (DataGridViewCellStyle). No results.
- I also tried changing Date format of dated to dd/MM/yyyy instead of dd/MM/yy. No results.
I use the following code to Sort Rows (Columns(3)) is the column that I want the DataGridView be sorded by.
Code:
DataGridView1.Sort(DataGridView1.Columns(3), System.ComponentModel.ListSortDirection.Ascending)
Any tips? Thanks so much!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|