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

  • Home
  • SEARCH
  • 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 8578143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:19:10+00:00 2026-06-11T20:19:10+00:00

I was working on a c# project using a DataGridView and ran into an

  • 0

I was working on a c# project using a DataGridView and ran into an issue.

Basically, I have a grid that gets updated from any number of places and has a button column.

I want to capture button clicks (of course) and do something which involves the other cells from that button’s row. As far as I know, the only way to associate a click with a row of the grid is via the RowIndex of the EventArgs.

What I’m worried about is that the grid may change between the user clicking and the event being delivered, causing an incorrect row to look like it was clicked.

Can this happen or am I being paranoid? If possible, is there anyway I can bind a reference to either the button or the row inside the eventargs so that I can differentiate the originating row even if its index has since changed?

  • 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-06-11T20:19:11+00:00Added an answer on June 11, 2026 at 8:19 pm

    GUI controls in WinForms are ‘tied’ to the UI thread.

    When you click the row, grid implementation handles this and as a part of the click handling raises an event – all on the same UI thread. Even if other threads change the grid content, this has to be serialized to the UI thread (typically with posting Windows messages in the background, or BeginInvoke in WinForms terminology – not exactly the same, but close).

    This means that even if there are concurrent changes, if your click is already registered, the event will not be interrupted by UI update.

    Note, however, that background thread could change the data object to which the row is bound while your handler runs, or between click occurred and event was handled. Still, it makes no difference to you, as grid UI update would need to be serialized and would still happen after your event handler.

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

Sidebar

Related Questions

I am working on a project using ReSharper. On occasion it prompts me that
I am working on a project using .Net mvc. I have a csharp class
I'm working on a project using Python and pyGTK. I have a window whose
I'm working on a project using Google Maps v3 that will allow users to
I am working on WinForms, .NET2 project. I am using a DataGridView control to
I am working on a project using an Arduino that needs to calculate the
I have been working on a project using OpenCV and have made a face
I'm working on a project using Apache Tiles 2.1 . I am running into
I'm working on a project using an Arduino and as such, I'm reading from
I am working on a project using MySQL and PHP. I will have many

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.