iamnotexpert
asked on
How to color the cells in a datacolumn? Vb.net
Hi,
I am new to vb.net, and I have a question regarding how to color-code the cells in a dataset. I have 2 tables in a dataset: revenue and expense. Now what I need is to color the cells based on their values.
This is an example of how the revenue table looks like:
1999 2000 2001
Shoes 97.5 55.6 78.5
Jewelry 105.1 ------ 97.5
Clothes ----- 15.5 14.8
bags 45.8 ----- 25.6
The dashes means that there are no data available. Now my problem is to color the fields according to their values. For example, for year 2001, I need to color the field with highest value to be red = RGB(255, 0, 0) and the lowest value to be black = RGB(0, 0, 0). Then the rest distribute the color evenly.
I tried to use the paint method from here, but that only work if you color the cell based on value range, HOW CAN I LOOP THROUGH THE COLUMN AND COLOR BASED ON THEIR VALUE?
Thanks in advance!
I am new to vb.net, and I have a question regarding how to color-code the cells in a dataset. I have 2 tables in a dataset: revenue and expense. Now what I need is to color the cells based on their values.
This is an example of how the revenue table looks like:
1999 2000 2001
Shoes 97.5 55.6 78.5
Jewelry 105.1 ------ 97.5
Clothes ----- 15.5 14.8
bags 45.8 ----- 25.6
The dashes means that there are no data available. Now my problem is to color the fields according to their values. For example, for year 2001, I need to color the field with highest value to be red = RGB(255, 0, 0) and the lowest value to be black = RGB(0, 0, 0). Then the rest distribute the color evenly.
I tried to use the paint method from here, but that only work if you color the cell based on value range, HOW CAN I LOOP THROUGH THE COLUMN AND COLOR BASED ON THEIR VALUE?
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.