Solved

datagrid view properties

Posted on 2009-04-11
7
236 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
[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
  • 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
Industry Leaders: 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!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

739 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