VB.Net - DataGridView Center Column Headings
Posted on 2013-01-09
Good Day Experts!
I am having trouble centering the column headings in my DataGridView. When I have the columns defined prior to loading the DataGrid with data it works fine. But I can't do that this time. So, I am trying to do everything programatically. I have the data centered in the columns but I cannot get the column headings centered. Here is what I am trying:
Dim dgvColumnHeaderStyle As New DataGridViewCellStyle()
dgvColumnHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
dgrdPossDupBills.ColumnHeadersDefaultCellStyle = dgvColumnHeaderStyle
Does anything look wrong with my coding?