Date and Time

iwtblj247

New member
Joined
Jan 22, 2007
Messages
1
Programming Experience
1-3
I have my database and I've linked it to a data grid. One field in the database has a date and time in it, but in the data grid, it shows up as only a date. As far as I can tell, all of the data types are set right. The dataset sees it as a Date/Time, but I can't get it to show the time. Anybody have any suggestions?
 
May be you can try to use the table style to format the datagrid, eg

VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] dgTableStyle [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataGridTableStyle
dgTableStyle = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataGridTableStyle
dgTableStyle.MappingName = TBL_BATCH
[/SIZE][SIZE=2][COLOR=#008000]' Set other properties.
[/COLOR][/SIZE][SIZE=2]dgTableStyle.AlternatingBackColor = Color.LightGray
dgTableStyle.AllowSorting = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] TextCol [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataGridTextBoxColumn[/SIZE][SIZE=2] = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataGridTextBoxColumn
TextCol.MappingName = "DateCol"
TextCol.HeaderText = "Date Col"
TextCol.Width = 80
TextCol.ReadOnly = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2]TextCol.Format = "dd/MM/yyyy HH:mm:ss"
dgTableStyle.GridColumnStyles.Add(TextCol)
[/SIZE]
 
Back
Top