Hello experts i have one datatable called newtable the first field contains a date time stamp that i converted to a string in military time. I am trying to fill another table called dt2 from the new table, but when i loop through the data in dt2 the rows are not sorted correctly any ideas?
The reason for this is that i want to convert the time back to normal once it is sorted then bind to datagrid, and i cant not sort a string field correctly by date time unless i use military time. The date field has to remain a string because i also insert characters into it. Currently this sort works but its military time:
"Datagrid3.DataSource = New DataView(newtable, "", "DatePLC", DataViewRowState.CurrentRows)". I cant figure out why my other sort is not working.
Dim dv As New DataView
Dim ds As New DataSet
.Table = ds.Tables(0)
.Sort = "DatePLC"
.RowStateFilter = DataViewRowState.CurrentRows
Dim dt2 As New DataTable
dt2 = dv.Table
Dim value2a As String
x = 0
For x = 0 To dt2.Rows.Count - 1
value2a = dt2.Rows(x).Item(0) ' i am using this to check the value
' when i get the sort working covert to normal time
x += 1
'Currently i am using this and it works except that it displays the military time.
Datagrid3.DataSource = New DataView(newtable, "", "DatePLC", DataViewRowState.CurrentRows)