Solved

VB.Net 2005 - DataGrid Header Centering

Posted on 2014-10-20
2
65 Views
Last Modified: 2015-02-13
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,
jimbo99999
0
Comment
Question by:Jimbo99999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
Kamal Khaleefa earned 500 total points
ID: 40394161
TRY TO SET THIS   dgrdLineItem.AutoGenerateColumns = FALSE
0
 

Author Comment

by:Jimbo99999
ID: 40400464
Hey There:

I apologize, but I need to generate them as I do not have them defined in the DataGrid.

Thanks,
jimbo99999
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question