Click here to Skip to main content
15,915,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a situation where I need to only display the month of a specific date in my Datagrid Column while keeping the underlying value
Posted

1 solution

Set the Format property of DefaultCellStyle of the concerned DataGridView Column to "MMM" as shown below, in a location before data is displayed, say in Load event of the Form
VB
DataGridView1.Columns(ColumnIndex).DefaultCellStyle.Format = "MMM"

Alternatively, this can be set in the designer by right clicking on the DataGridView selecting the EditColumns menu option. Then selecting the Column concerned in the list of columns and setting the "MMM" DefaultCellStyle in the propertygrid.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900