473,403 Members | 2,284 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,403 software developers and data experts.

changing the color of the entire row in datagrid when a cell in the row has value greater than zero

hello everybody,

I am having a datagrid which has data regarding customers. it has a
penalty column, and i want to show the entire record of the customer
in red whose penalty is greater than zero.

i have looked into the other messages which guide to override the
paint procedure of the datagrid, make a new class etc.

i am not able to understand the exact way of doing the mentioned
things.

i'll be thankful if somebody pours in some help.

hemant.
Nov 21 '05 #1
2 1329
Hi,

Maybe selecting the row will work for you.

Dim conn As SqlConnection

Dim strConn As String

Dim strSQL As String

Dim da As SqlDataAdapter

Dim ds As New DataSet

strConn = "Server = (local);"

strConn &= "Database = NorthWind;"

strConn &= "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)

da = New SqlDataAdapter("Select * From Products", conn)

da.Fill(ds, "Products")

DataGrid1.DataSource = ds.Tables("Products")

For x As Integer = 0 To ds.Tables("Products").Rows.Count - 1

Dim dr As DataRow = ds.Tables("Products").Rows(x)

If CInt(dr.Item("UnitsInStock")) < 5 Then DataGrid1.Select(x)

Next

Ken

-----------------------

"hemant" <he********@yahoo.com> wrote in message
news:1b**************************@posting.google.c om...
hello everybody,

I am having a datagrid which has data regarding customers. it has a
penalty column, and i want to show the entire record of the customer
in red whose penalty is greater than zero.

i have looked into the other messages which guide to override the
paint procedure of the datagrid, make a new class etc.

i am not able to understand the exact way of doing the mentioned
things.

i'll be thankful if somebody pours in some help.

hemant.
Nov 21 '05 #2
"hemant" <he********@yahoo.com> wrote in message
news:1b**************************@posting.google.c om...
hello everybody,

I am having a datagrid which has data regarding customers. it has a
penalty column, and i want to show the entire record of the customer
in red whose penalty is greater than zero.

i have looked into the other messages which guide to override the
paint procedure of the datagrid, make a new class etc.

i am not able to understand the exact way of doing the mentioned
things.

i'll be thankful if somebody pours in some help.

hemant.


I think if selecting the whole row is no good it'd be a hell of a lot easier
if you just highlit the textbox has the negative amount in it.
Check out george shepherd's faq site.
The datagrid section might have some ideas in it for you.

I suppose you could maybe mark an error in the row selector thing.

--
Regards,
Andy O'Neill
Nov 21 '05 #3

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

Similar topics

2
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic...
15
by: | last post by:
Just about finished with an include modual that allows a user to select a color. Completely dynamic. all you have to do is include the script and run the main trigger script. One problem with...
4
by: David Krmpotic | last post by:
Hello, Can please tell me how to do it ? This should be simple, because I'd think it's used a lot.. but in reality is not that simple and there is at least 50 topics about it in newsgroups,...
0
by: enahar | last post by:
I want to validate a cell wheather a value is greater than 0 or not.If value is greater than 0 then I want to show messagebox and focus back the same cell else move to the other cell. I am...
1
by: Shawn Benson | last post by:
I have a Windows form where a user enters an order number which returns a dataset that is bound to a datagrid. The problem is when a user clicks on a cell in the datagrid, then enters another...
3
by: Mad Scientist Jr | last post by:
Can someone post a clear example of how to change the background color of an individual datagrid cell for a Windows desktop app? (preferably in vb.net) I found some code on how to do this when...
4
by: John Smith | last post by:
Hi All; I am using the HeaderAndDataAlignColumn class from Ken Tucker. I have customized it for a wider row. I reposition the DrawString method so the text is centered vertically in the row. ...
2
by: chris357 | last post by:
I am new to .Net. Currently I am creating a windows application. I would like to know how to change the row color in a datagrid based on the value present in the cell in datagrid. For eg:- in my...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.