DataGridView DateTime Column type?

StewartBW 1,830 Reputation points
2025-06-28T02:06:23.96+00:00

Hi experts

In VB.net WinForms (.Net Framework 4.8) DataGridView Add/Edit Column > Column Type has these members:

DataGridViewButtonColumn
DataGridViewCheckBoxColumn
DataGridViewComboBoxColumn
DataGridViewImageColumn
DataGridViewLinkColumn
DataGridViewTextBoxColumn

There's no DataGridViewDateTimeColumn type! So how to set a Column to DateTime to be able to sort at run time by date/time correctly (by clicking on the column header)?

The AI suggested to set the column type to DataGridViewTextBoxColumn and set the DefaultCellStyle.Format = MM-dd-yyyy HH:mm

Is that OK or there are better ways to go with DataGridView?

Thanks everyone :)

Developer technologies | Windows Forms
0 comments No comments
{count} vote

Accepted answer
  1. KOZ6.0 6,735 Reputation points
    2025-06-29T19:48:37.3233333+00:00
    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.