【发布时间】:2014-08-19 05:15:35
【问题描述】:
所以我有一个名为 dtgQue 的数据网格视图,这里是我的列的属性。
'Setting the Properties for the Due Date
QueDueDate.Name = "DueDate"
QueDueDate.ValueType = GetType(Date)
QueDueDate.HeaderText = "Due Date"
QueDueDate.CellTemplate = New DataGridViewTextBoxCell
然后在我向该列添加一堆行之后,我再做一个
dtgQue.Sort(dtgQue.Columns(3), System.ComponentModel.ListSortDirection.Descending)
但它的排序不是 100% 正确的,例如这里是一组按排序方式排列的日期。 2014 年 9 月 8 日、2014 年 9 月 2 日、2014 年 9 月 15 日、2014 年 10 月 1 日如您所见,出于某种原因,它在 9/8 之后放置了 9/2,这是不正确的。
【问题讨论】:
-
对应的
DataGridViewColumn.ValueType是什么? -
正如@Neverhopeless 的回答所表明的那样,您可能在列中使用了不理想的数据类型,例如一个字符串,它应该是一个日期。看看这篇 MSDN 文章:msdn.microsoft.com/de-de/library/…
标签: .net vb.net sorting datagridview