Good Day Experts!
I am having a bit of trouble trying to get my column headings in the DataGrid to be centered in the header cell. The columns are getting generated at runtime.
I am using the following code to try an add the centering:
Dim dgvColumnHeaderStyle As New DataGridViewCellStyle()
dgvColumnHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
dgrdLineItem.ColumnHeadersDefaultCellStyle = dgvColumnHeaderStyle
dgrdLineItem.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells
dgrdLineItem.AutoGenerateColumns = True
dgrdLineItem.DataSource = tblLineItemsFinal
Does that look good to you? What am I missing?
Thanks for your advice,