Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Set DataGridView Column Header Allignment In Code

$
0
0

Hello Again

I'm trying to set the Column Header text alignment for two specific columns, using this code:

        dgvBooks.Columns(1).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter

        dgvBooks.Columns(6).DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter

The code seems to have no effect. The index values are correct and no error is thrown, the property and the property "Enable HeadersVisualStyles" is set to False and the column index is correct.

Milt

DataGridViewContentAlignment.MiddleCenter



sirmilt


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>