Hi all,

I am not sure why this is happening. But I am loading a .csv file and just showing it in a datagrid. However, in the .csv field I have time like 0030 but when is showed in the datagrid it is just 30.

Any suggestion?

Recommended Answers

All 3 Replies

In which format do you have "0030"?

this.dataGridView1.Columns["MyColumnName"].DefaultCellStyle.Format = "hh:mm";

Should do the trick assuming you've converted the data to a DateTime.

this.dataGridView1.Columns["MyColumnName"].DefaultCellStyle.Format = "hh:mm";

Should do the trick assuming you've converted the data to a DateTime.

That worked. However, what about if I want to change the column in the data set instead the datagridview? I want to be able to save the data into the db.

I tried: dt.Columns["Time"].DataType = System.Type.GetType("System.DateTime");

But did not work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.