Hi,
I'm using VB 2005 and I have a DataGridView that I am populating manually.
e.g.
[code=vbnet]
Private Sub List_Dates()
dgvDates.Rows.C lear()
Dim c As Integer
Dim Row() As String = New String(3) {}
For c = 0 To WorkstationCoun t
Row(0) = Workstations(c)
Row(1) = FormatDateTime( DatesAssign(c), DateFormat.Shor tDate)
Row(2) = FormatDateTime( DatesAgent(c), DateFormat.Shor tDate)
dgvDates.Rows.A dd(Row)
Next
End Sub[/code]
The context is that I'm reading in a set of files (one for each workstation) with various data in that I am parsing, including two dates, then saving this data in various arrays before putting in DataGridViews to display.
Anyway, everything works fine except that when I click on the column header to sort the two dates columns, they sort as a string, not as a date.
I've seen various very similar questions, but none of them answer the question for me (I suppose primarily because I am not binding a data source).
What can I do to get these columns to sort as a date?
Thanks,
Steve
I'm using VB 2005 and I have a DataGridView that I am populating manually.
e.g.
[code=vbnet]
Private Sub List_Dates()
dgvDates.Rows.C lear()
Dim c As Integer
Dim Row() As String = New String(3) {}
For c = 0 To WorkstationCoun t
Row(0) = Workstations(c)
Row(1) = FormatDateTime( DatesAssign(c), DateFormat.Shor tDate)
Row(2) = FormatDateTime( DatesAgent(c), DateFormat.Shor tDate)
dgvDates.Rows.A dd(Row)
Next
End Sub[/code]
The context is that I'm reading in a set of files (one for each workstation) with various data in that I am parsing, including two dates, then saving this data in various arrays before putting in DataGridViews to display.
Anyway, everything works fine except that when I click on the column header to sort the two dates columns, they sort as a string, not as a date.
I've seen various very similar questions, but none of them answer the question for me (I suppose primarily because I am not binding a data source).
What can I do to get these columns to sort as a date?
Thanks,
Steve
Comment