Update DataGridView Control

G

Guest

I have a realtime stock quote system developed where I am updating a typed
dataset with realtime quotes. I want my DataGridView control to show green
forecolor when a price moves up and red forecolor when a price moves down. I
am using the cellvaluechanged event of the DataGridView control and thought
it would be fired when the Dataset(the DataGridView's datasource) is updated.
CellValueChanged is not fired when the dataset is updated. Is there another
DataGridView event handler I need to use for this?
Thanks,
David
 
C

Chris Jobson

David said:
I have a realtime stock quote system developed where I am updating a typed
dataset with realtime quotes. I want my DataGridView control to show
green
forecolor when a price moves up and red forecolor when a price moves down.
I
am using the cellvaluechanged event of the DataGridView control and
thought
it would be fired when the Dataset(the DataGridView's datasource) is
updated.
CellValueChanged is not fired when the dataset is updated. Is there
another
DataGridView event handler I need to use for this?

From trhe help on DataGridView "The DataGridView.CellValueChanged event
occurs when the user-specified value is committed, which typically occurs
when focus leaves the cell.", i.e. this event is used for changes the user
makes. You could probably use the CellFormatting event for your colour
changes, but be aware that this event will be called whenever the cell needs
to be painted (e.g. if the user scrolls the grid, or minimises then restores
the application) and not just when the bound value has changed.

Chris Jobson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top