DataGridView format to short time
Hi All.
My stored procedure covert two integer column Hours and Minutes to varchar data type and after concatenation the result looks like HH:MM (1:05).
In DGV form I have problem to display same values. The EmpTime column is dispay time like (1:5). The column's coding is:
Me.DataGridView.Columns("EmpTime").DefaultCellStyle.Format = "HH:mm".
How to fix that problem.
Thanks.
Re: DataGridView format to short time
Me.DataGridView.Columns("EmpTime").DefaultCellStyle.Format = "t"
for more see: http://msdn.microsoft.com/en-us/library/97x6twsz.aspx
Re: DataGridView format to short time
You convert 2 integer fields to a varchar field... Since varchar is string type, the formatting won't work. However, the datagridview will display it "as is". You need to double check the conversion perfromed by your stored procedure and make sure that it produces the correct result. It may not be hwat you think it is.