Click here to Skip to main content
15,914,500 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

i am doing an windows mobile development using VS2008. I need to right align the numeric type column in the datagrid. I have binding a datatable to the datagrid using

datagrid1.datasource= datatable

the problem is how can i right align the numeric type column in the datagrid.

any help would be really appreciated

thanks

pete
Posted

1 solution

Set the DefaultCellStyle of the relevant column to something like this;

C#
DataGridViewCellStyle cellStyle = new DataGridViewCellStyle();
cellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
someColumn.DefaultCellStyle = cellStyle;


Hope this helps,
Fredrik
 
Share this answer
 

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