472,975 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

change fore color of single cell in a datagrid

L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald
Nov 13 '05 #1
3 6621
Erald,

This is difficult with the current DataGrid. The reason is that
determining how to render contents on the grid is done on a per-column
basis. Because of this, you would have to create a class that derives from
DataGridColumnStyle and then handle the rendering of the background color
based on the value.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <er***@delta-travel.nl> wrote in message
news:d9**************************@posting.google.c om...
L.S.

in a datagrid I would like the forecolor of a single cell. Because it
is a negative number. This cannot be done by changing the NumberFormat
property.
So how can I do this??

Erald

Nov 13 '05 #2
Erald,

Honestly, I do think that it is the wrong way (the way they implemented
it). I think that there are third party controls out there which do a much
better job. One of the ones I like is the grid from Xceed software. You
can find more information about it at:

http://www.xceedsoft.com/products/GridNet/
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Erald Kulk" <an*******@devdex.com> wrote in message
news:eD**************@tk2msftngp13.phx.gbl...


Nicholas Paldino,

thank you for your answer. I will have to figure out how to derive the
class correctly, but I think I'll manage.
Quite strang it is that complicated, but that's probably too
philosophical.

Erald Kulk

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #3
thank you for the advise. By extending the DataGridColumnStyle and
changing the overridden pain method I created the datagrid I intended
to have. New problem. This column has an expression to calculate its
values. But this generates an error when saving. cannot change the
readonly property of the expressioncolumn. or something like that. I
got the error in dutch.

anybody any idea?

Erald Kulk
Nov 13 '05 #4

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

Similar topics

8
by: amber | last post by:
Hello, How can I trigger an event, when a value (cell) in my datagrid changes? TIA, amber
3
by: Richard | last post by:
I'm trying to change a value of a cell based on another before the grid is displayed. I'm using the ItemDataBound event like this for a simple test: Select Case e.Item.ItemType Case...
4
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
5
by: Earl | last post by:
I want to fire a database update off of a single change to a single cell in the datagrid. This apparently cannot be done using keypress, keyup, keydown, etc. I've read George Shepard's FAQ and...
3
by: John Smith | last post by:
I'm looking into this peace of code: protected void DropDown_SelectedIndexChanged(object sender, EventArgs e) { DropDownList list = (DropDownList)sender; TableCell cell = list.Parent as...
2
by: John Smith | last post by:
Will this line of the code: item.Cells.Text = "Some text..."; change only DataGrid visual value or it will also change value in the DataSource? How can I change value in DataSource? ...
3
by: Jim in Arizona | last post by:
I have a gridview that's being populated from an access db query. The problem I'm having is that the date/time fields in access that are populating the gridview are showing both date and time, when...
2
by: =?Utf-8?B?TWlrZQ==?= | last post by:
Greetings, I am trying to find out how to do something that on the surface seems like it should be very simple to do. I have a datagrid with a datatable bound to it using the SetDataBinding...
0
by: joinzulfi | last post by:
Dear fellows! I have designed a form having SaleMasterTable and SaleDetailTable. SaleDetailTable is Bounded with DataGrid. Now I want that if in2nd Column's cell (it is combobox) value is...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.