Solved

datagrid view properties

Posted on 2009-04-11
7
226 Views
Last Modified: 2013-12-20
hello i  use datagrid in a form and i want 1) to move the fields in the above photo in the center 2) put a color behind the fields 3) minus the font of the fields.How i  can do these

i am using vb 2005

Thnks for the help
untitled.PNG
0
Comment
Question by:demoniumz
  • 3
  • 2
  • 2
7 Comments
 
LVL 1

Author Comment

by:demoniumz
ID: 24124772
anyone to help pls
0
 
LVL 1

Author Comment

by:demoniumz
ID: 24124914
HELLO
0
 
LVL 48

Accepted Solution

by:
jpaulino earned 500 total points
ID: 24125032
1) To center the header text

Me.DataGridView1.RowHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter
2) On the column 3 (index 2) but some backcolor

Me.DataGridView1.Columns(2).DefaultCellStyle.BackColor = Color.AliceBlue
3) You want to change the font ?

Me.DataGridView1.Font = New Font("Arial", 8)
0
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

 
LVL 1

Author Comment

by:demoniumz
ID: 24125190
center not work  can  i move  the space between  each field  to be more nice  

example ok (these i need to appear)
Categor Name !Category ident

not  like these (appear now)
Categories Name !    Category ident    !      picture !
 
0
 
LVL 48

Expert Comment

by:jpaulino
ID: 24125822
Can you show a picture ?
Just note that it will not be correctly center because some space on the right are reserved to the sort arrows. If you don't need to sort you can remove it that option and the text will be correctly at the center.
0
 
LVL 33

Expert Comment

by:jppinto
ID: 24125955
What jpaulino is saying is that, for instance, use this to center the header text:

Me.DataGridView1.RowHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter

and on the columns that you don't need to sort ascending or descending, to remove the sort glyph (the small triangle that appears on the header, right of the header text), use this for each column:

Me.DataGridView1.Columns("CategoryName").SortMode = DataGridViewColumnSortMode.NotSortable

this will remove the sort glyph and allow the text to be sorted right on the middle of the column header.

jppinto

0
 
LVL 33

Expert Comment

by:jppinto
ID: 24125989
Check the picture of this post to see if this is what you're getting on the headers texts:

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_24303598.html

with my previous post, you will be able to solve the problem as I solved mine.

jppinto
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 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

13 Experts available now in Live!

Get 1:1 Help Now