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 176963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:58:14+00:00 2026-05-11T13:58:14+00:00

I have a PropertyGrid in my application that is used for editing arbitrary objects.

  • 0

I have a PropertyGrid in my application that is used for editing arbitrary objects. I need to be able to run an arbitrary subroutine on another thread that also looks at these objects (search functionality, if you’re curious). The obvious issue is that a user could be editing one of these objects at the same time my search thread is reading it, which would be preferable to avoid (although it probably won’t result in anything critical since my search thread is just reading, not writing).

Calling lock(obj) is easy enough from my search thread, but after looking through the documentation and a brief skim through the PropertyDescriptorGridEntry code in Reflector, I cannot seem to find an analogous spot to use a System.Threading.Monitor.Enter()/Exit() call on the object in question on the PropertyGrid. I was hoping there would be BeginEdit and EndEdit events which would make this simple enough, but I can’t seem to find any such thing. I’d rather not lock the entire object while it’s on display in the PropertyGrid as that would obviously block my search thread until another object was selected.

I’m a bit new to the threading model of Windows Forms, so I’m hoping there’s some obvious answer I’ve just overlooked. Any help?

Edit: Synchronously cloning my objects before running the search asynchronously will likely be inefficient enough that I might as well run the search itself synchronously – the point of running asynchronously is of course to allow my users to continue to work while the search is executing. The search needs to scale well, as the data set I am going through will eventually end up being arbitrarily large, which makes synchronous cloning look like it will cause the usability problem I am trying to avoid.

  • 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. 2026-05-11T13:58:15+00:00Added an answer on May 11, 2026 at 1:58 pm

    I think you are going to have to do quite a bit of work for this.

    First, you would have to create an implementation of ICustomTypeDescriptor which would base its implementation on whatever TypeDescriptor you would normally get for that type.

    Then, in the implementations of the methods which expose the descriptors of the members you want to lock on, you would provide subclasses which derive from those descriptors and override the appropriate methods to wrap a lock around.

    So for a property, you would implement GetProperties to return your specific subclasses of PropertyDescriptor. These subclasses would override the GetValue and SetValue methods (and others) and use a lock when accessing those variables.

    It should be mentioned that locking like this in the UI thread is probably a bad idea, since you don’t want to arbitrarily block operations on that thread. It might be better to just create a clone of the object and then have a method which updates the store of objects when you are done.

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

Sidebar

Ask A Question

Stats

  • Questions 162k
  • Answers 162k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Set the (UIKeyboardType)keyboardType and (UIReturnKeyTYpe) returnKeyType The options are documented… May 12, 2026 at 11:55 am
  • Editorial Team
    Editorial Team added an answer I think you want to look at the INamingContainer interface.… May 12, 2026 at 11:55 am
  • Editorial Team
    Editorial Team added an answer You cannot have multiple WHERE clauses for any SQL statement,… May 12, 2026 at 11:55 am

Related Questions

Okay, I'll be straight with you guys: I'm not sure exactly how Domain Driven
How can I customize the sorting of categories in a PropertyGrid ? If I
I have a set of custom PropertyDescriptor that I want to add categories too
I am using a PropertyGrid to show properties from my objects. However, I'm also

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.