How can I right-align text in a DataGridView column?

Jayantha Lal Sirisena picture Jayantha Lal Sirisena · Mar 8, 2011 · Viewed 133.4k times · Source

How can I right-align text in a DataGridView column? I am writing a .NET WinForms application.

Answer

MUG4N picture MUG4N · Mar 8, 2011
this.dataGridView1.Columns["CustomerName"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;