Solved

VB.Net 2005 - DataGrid Header Centering

Posted on 2014-10-20
2
58 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now