473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Why not color?

I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database
(Access 2002). Does anyone have info or know where I can go to change the
color of a row based on the value in one column? I have found stuff on
alternating colors and all that good stuff but nothing that I need. Thanks
Nov 21 '05 #1
3 1081
Hi Brix,
Have a look at: http://64.78.52.104/FAQ/WinForms/default.asp
under the datagrid section.

Item 5.14 might be helpful

Doug

"brix_zx2" <br*****@discussions.microsoft.com> wrote in message
news:D0**********************************@microsof t.com...
I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database (Access 2002). Does anyone have info or know where I can go to change the
color of a row based on the value in one column? I have found stuff on
alternating colors and all that good stuff but nothing that I need.

Thanks
Nov 21 '05 #2
It'd be nice to have conditional formatting as found in Access, wouldn't
it? :) Thankfully there's another way.

You can attach a handler to the ItemDataBound event of the DataGrid
class. This event is fired once for each row in your datagrid. Check the
appropriate field, and if it matches your requirements, colour the
entire row.

---
Private Sub OnItemDataBound(Sender as Object, E as
DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If CType(e.Item.DataItem, DataRowView)("YourColumn") = 3 Then
E.Item.BackColor = KnownColor.AliceBlue
End IF
End Sub
---

Hope that helps you.
Regards,
-Adam.

brix_zx2 wrote:
I'm writing a program in VB .NET 2k3, I have a datagrid bound to a database
(Access 2002). Does anyone have info or know where I can go to change the
color of a row based on the value in one column? I have found stuff on
alternating colors and all that good stuff but nothing that I need. Thanks

Nov 21 '05 #3
"brix_zx2" <br*****@discussions.microsoft.com> schrieb:
I'm writing a program in VB .NET 2k3, I have a datagrid bound to a
database
(Access 2002). Does anyone have info or know where I can go to change the
color of a row based on the value in one column?


(Syncfusion links may be slow...)

5.14 How do I color a individual cell depending upon its value or some
external method?
<URL:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q745q>

5.67 How can I change the font used in a grid cell on a cell by cell or row
by row basis?
<URL:http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q927q>

Changing the background color of cells in a DataGrid
<URL:http://www.codeproject.com/csharp/custom_datagridcolumnstyl.asp>

<URL:http://www.google.de/groups?selm=avm8j6%24guusa%241%40ID-117757.news.dfncis.de>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dan glenn | last post by:
(PHP4.3.4, GD2) How can I save a PNG using GD2 and insure that it saves as a palette-based (8-bit, 256-color) single-color transparancy?? Saving this way, I could be sure that an image loaded from...
6
by: me | last post by:
good day, i found this message: and i want to know more about it too. ========================================== Hey all, example:...
6
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black...
3
by: Richard A. DeVenezia | last post by:
I hope this is the end of my present 'discovery' phase. I've learned alot about JavaScript in a short time and my head hurts. The following is what came out of all my questions and all the...
5
by: Chris Beall | last post by:
I'm displaying an image that is also a link against a black background. In Netscape 7.1, the current background color is displayed as a horizontal bar below the image. This allows :hover effects...
4
by: bart plessers | last post by:
Hello, I am making a website where the user can choose a 'skin'. This works with asp en stylesheets. In the stylesheet, a number of tags are (re)defined. The main idea is to have a limited...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
25
by: Neal | last post by:
According to the CSS lint at http://htmlhelp.org/tools/csscheck/, "The shorthand background property is more widely supported than background-color." Can anyone point me to, or provide, information...
27
by: Kevin Yu | last post by:
When I declare on HTML page <LINK href="mycss.css" type="text/css" rel=stylesheet /> .... <BODY class=myclass> in mycss.css BODY { FONT-WEIGHT: bold; FONT-SIZE: 12px; FONT-FAMILY:...
7
by: Jonathan N. Little | last post by:
When doing a final check on my stylesheets the CSS Validator flag lines like this one as an error: ADDRESS A { color: gold; } Error is: # Line: 31 Context : ADDRESS A Invalid number :...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.