Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7608635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:58:04+00:00 2026-05-31T00:58:04+00:00

There does not seem to be a definitive answer for similar questions on SOF.

  • 0

There does not seem to be a definitive answer for similar questions on SOF.

I have a DataGridView that is bound to a BindingList<T> object (which is a list of custom objects; also inherits INotifyPropertyChanged). The custom objects each have a unique timer. When those timer’s pass a certain value (say 10 seconds), I want to change the cell’s forecolor to red.

I am using the CellValueChanged event, but this event never seems to fire, even though I can see the timer changing on the DataGridView. Is there a different event I should be looking for? Below is my CellValueChanged handler.

private void checkTimerThreshold(object sender, DataGridViewCellEventArgs e)
    {
        TimeSpan ts = new TimeSpan(0,0,10);
        if (e.ColumnIndex < 0 || e.RowIndex < 0)
            return;
        if (orderObjectMapping[dataGridView1["OrderID", e.RowIndex].Value.ToString()].getElapsedStatusTime().CompareTo(ts) > 0)
        {
            DataGridViewCellStyle cellStyle = new DataGridViewCellStyle();
            cellStyle.ForeColor = Color.Red;
            dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Style = cellStyle;
        }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:58:05+00:00Added an answer on May 31, 2026 at 12:58 am

    There is no way this I know of to make the DataGridView raise an event when its DataSource is programatically changed – this is by design.

    The best way I can think of to meet your requirement is to introduce a BindingSource into the mix – binding sources do raise events when their DataSource changes.

    Something like this works (you will obviously need to fine tune it to your needs):

    bindingSource1.DataSource = tbData;
    dataGridView1.DataSource = bindingSource1;
    bindingSource1.ListChanged += new ListChangedEventHandler(bindingSource1_ListChanged); 
    
    public void bindingSource1_ListChanged(object sender, ListChangedEventArgs e)
    {
        DataGridViewCellStyle cellStyle = new DataGridViewCellStyle(); 
        cellStyle.ForeColor = Color.Red;
    
        dataGridView1.Rows[e.NewIndex].Cells[e.PropertyDescriptor.Name].Style = cellStyle;
    }
    

    Another option to to do this by subscribing directly to the data – if it is a BindingList it will propogate the NotifyPropertyChanged events using its own ListChanged event. In a more MVVM scenario that would possibly be cleaner but in WinForms the BindingSource is probably best.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a method of accessing an Exchange server that does not have IMAP
SO i have searched on stackoverflow and there does not seem to be any
Is there a particular way to initialize an IList<T> ? This does not seem
There are some section in the table that does not contain any data and
Is there an API (Twitter API does not provide this) that I can use
Is there a way to use form fields that does not correspond to database
Is there a way for something to raise and exception that does not descend
Is there any html form class(text box) that does not allow null values. The
I have looked at most of the questions on this subject and there does
I am using the theme DarkExpression from WPF Futures . It does not seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.