Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dbgrid coloring

Status
Not open for further replies.

jasperjasper

Programmer
Mar 23, 2004
117
US
Is there an easy way to add color to a grid column...say its based on an amount > 0 green....
I have been sent some code but its lengthy...in VB6 it was one line of code...like cell.backcolor = green

Cant i do this in VB.NET
 
BackColor - Overridden. Gets or sets the background color of the grid.

BackgroundColor - Gets or sets the color of the non-row area of the grid.

CaptionBackColor - Gets or sets the background color of the caption area.

CaptionForeColor - Gets or sets the foreground color of the caption area.

ForeColor - Overridden. Gets or sets the foreground color (typically the color of the text) property of the System.Windows.Forms.DataGrid control.

GridLineColor - Gets or sets the color of the grid lines.

HeaderBackColor - Gets or sets the background color of all row and column headers.

HeaderForeColor - Gets or sets the foreground color of headers.

LinkColor - Gets or sets the color of the text that you can click to navigate to a child table.

LinkHoverColor - Gets or sets the color a link changes to when the mouse pointer moves over it.

ParentRowsBackColor - Gets or sets the background color of parent rows.

ParentRowsForeColor - Gets or sets the foreground color of parent rows.

SelectionBackColor - Gets or sets the background color of selected rows.

SelectionForeColor - Gets or set the foreground color of selected rows.




Now what part were you trying to set the color for?

-Rick

----------------------
 
I wanted to set the forecolor of one column (Amount) in the grid. I read each amount in a loop, and if the amount is < 0 i want the text to display red, else green.
In VB6 this was easy....
 
you should be able to do this on the ItemCreated command for the datagrid...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top