?
Solved

VB.Net 2005 - DataGrid Header Centering

Posted on 2014-10-20
2
Medium Priority
?
66 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

741 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