Centering Column and Row Text Content in DataGridView
alignment, c#, datagridview
Solution
Try this.
dataGridView1.RowsDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
Problem
I want to center the content of my Columns and Rows on DataGridView. Is there a way of doing this by specifying the Column name, like: ``` dataGridView1.Columns["CustomerName"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; ``` I want this to be applied to all the Columns of my DataGridView (which is completely coded programmatically). How can I do this?