In previous versions of True DBGrid for WinForms, the default behavior in a column with a DataType of DateTime was to display both the date and the time in the column. Currently the default behavior is to display only the date. In the following steps, you'll set the column's NumberFormat property to "g" (which displays the short date and short time according to your current culture's format) for both the data and time to be displayed and you'll disable the DateTimePicker used to edit the date and time at run time.
Complete the following steps to display both the date and the time in the column:
Add the following code to the Form_Load event to display both the date and the time in the second column:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Me.C1TrueDBGrid1.Columns(1).EnableDateTimeEditor = False Me.C1TrueDBGrid1.Columns(1).NumberFormat = "g" |
To write code in C#
C# |
Copy Code
|
---|---|
this.c1TrueDBGrid1.Columns[1].EnableDateTimeEditor = false; this.c1TrueDBGrid1.Columns[1].NumberFormat = "g"; |
The selected column displays both the date and the time.