abcfantasy
Programmer
Hello, I've got the following case:
I have a DataGridView which is dynamically (during runtime) bounded to a DataTable. What I wish is to format certain columns, but it seems all formatting is being ignored.
I have tried:
but no result.
Then I tried using the CellFormatting event:
But still no use.
Is it because of the data source being a DataTable? Perhaps formatting is in someway overridden?
Any help is appreciated.
Thanks.
|| ABC
I have a DataGridView which is dynamically (during runtime) bounded to a DataTable. What I wish is to format certain columns, but it seems all formatting is being ignored.
I have tried:
Code:
dataGridView.Columns["ColumnName"].DefaultCellStyle.Format = "c"
Then I tried using the CellFormatting event:
Code:
private void dataGridView_CellFormatting( object sender, DataGridViewCellFormattingEventArgs e )
{
if ( e.ColumnIndex = 1 )
e.CellStyle.Format = "c"
}
Is it because of the data source being a DataTable? Perhaps formatting is in someway overridden?
Any help is appreciated.
Thanks.
|| ABC