2016-01-06 22 views

回答

1

您可以在设计或运行时使用DataGridViewCellStyle.Format属性将格式设置为dd-MMM-yy。然后它显示日期为06-Jan-16

转至Columns属性,并打开Edit Columns窗口。在Appearance类别下,编辑DefaultCellStyle,打开CellmStyle Builder窗口并在Behavior类别下输入自定义Format

您也可以在...点击并打开Format String Dialog和预定义格式和自定义格式之间进行选择,并输入有自定义格式:

或者使用代码,你可以这样写代码:

Dim DataGridViewCellStyle1 = New DataGridViewCellStyle() 
DataGridViewCellStyle1.Format = "dd-MMM-yy" 
Me.Column1.DefaultCellStyle = dataGridViewCellStyle1 

欲了解更多信息关于可以使用Format属性的支持格式,请参见Formatting Types in the .NET Framework

相关问题