Visual Studio Development Bookmark and Share   
 index > Visual C# Express Edition > DataGridView throws an exception when sorting "2.2.2009"
 

DataGridView throws an exception when sorting "2.2.2009"

Hi,
I have a problem with datagrid - when I add a string like "22.12.2009" and click on the column header in order to sort it, it throws an expcetion that "IComparable has tobe implemented" (or something like that).
I guess it would sort it numerically, though. Is there a way how to sort it as "date" types?
Thanks!
Blizna  Tuesday, September 29, 2009 8:10 AM
Hi,

Please take a look at a look at the article :Customize Sorting in the Windows Forms DataGridView Control
http://msdn.microsoft.com/en-us/library/ms171608.aspx

You can implement it to sort datatime datatype.

If you have any problem with it, just feel free to post back.

Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer byBlizna Monday, October 05, 2009 6:48 AM
  •  
Harry Zhu  Monday, October 05, 2009 4:30 AM
Hi,

Please take a look at a look at the article :Customize Sorting in the Windows Forms DataGridView Control
http://msdn.microsoft.com/en-us/library/ms171608.aspx

You can implement it to sort datatime datatype.

If you have any problem with it, just feel free to post back.

Harry
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
  • Marked As Answer byBlizna Monday, October 05, 2009 6:48 AM
  •  
Harry Zhu  Monday, October 05, 2009 4:30 AM

You can use google to search for other answers

Custom Search

More Threads

• Publishing
• DGV Cell Size
• bind hscrollbar to label/textbox
• Tutorial on adding dataset from access database programatically
• Is it possible ?
• NotifyIcon missing in Toolbox (2008)
• How can I get UML from code?
• User control - Communication between user control
• a newbie needing help with random numbers and the chi square test as described by Donald Knuth
• Running a second program from C# to convert a file that C# needs later?