473,397 Members | 2,028 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Force property update in propertygrid

I was wondering if there is a way to force a property within a property grid
to update and then display a modified value when when a second property
(true/false) is toggled?
--
Steve
Dec 16 '05 #1
3 11272
Steve,

In .NET 1.1 and before, you want to create an event of type EventHandler
named <property>Changed. You would then fire this event after you set the
property (internally, so that a call to the get accessor of the property
will return the new value).

In .NET 2.0 and above, you can do as mentioned previously, and you can
also implement INotifyPropertyChanged interface, which has one member, an
event that is fired when the property changes.

When the property changes, you can fire this event and indicate which
property changed.

The property grid will detect this, and then update itself accordingly.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Teeples" <St**********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
I was wondering if there is a way to force a property within a property
grid
to update and then display a modified value when when a second property
(true/false) is toggled?
--
Steve

Dec 16 '05 #2
Nicholas, thank you. This did the trick. I had to add another event for the
property grid that actually updated the property visually when a
PropertyValueChanged event occurred. Without it, I only know the string was
being updated when I would click its property in the grid.
--
Steve
"Nicholas Paldino [.NET/C# MVP]" wrote:
Steve,

In .NET 1.1 and before, you want to create an event of type EventHandler
named <property>Changed. You would then fire this event after you set the
property (internally, so that a call to the get accessor of the property
will return the new value).

In .NET 2.0 and above, you can do as mentioned previously, and you can
also implement INotifyPropertyChanged interface, which has one member, an
event that is fired when the property changes.

When the property changes, you can fire this event and indicate which
property changed.

The property grid will detect this, and then update itself accordingly.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Steve Teeples" <St**********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
I was wondering if there is a way to force a property within a property
grid
to update and then display a modified value when when a second property
(true/false) is toggled?
--
Steve


Dec 17 '05 #3
tlhintoq
3,525 Expert 2GB
I know this is an OLD thread, but for the next person looking for a response this works quite well for me:

Expand|Select|Wrap|Line Numbers
  1. object Temp = propertyGrid1.SelectedObject;
  2.                 propertyGrid1.SelectedObject = null;
  3.                 propertyGrid1.SelectedObject = Temp;
Feb 26 '10 #4

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

Similar topics

2
by: Chris Dunaway | last post by:
I am using the PropertyGrid and I have set the SelectedObject property to an instance of my custom class. One of the properties of the custom class is a bitmap. The PropertyGrid lets me assign...
0
by: Patrick B | last post by:
I'm wondering about the mechanics of databinding. Say that a textbox is bound to a property of a business object. The business object is a "Person". The control is a textbox called...
2
by: X.W. | last post by:
Hi group, I have a class like this: class Person { public uint Age { get{...} set{...} }
7
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
4
by: John Lafrowda | last post by:
Hi all, I'm trying to handle two projects in one solution (.net 2002, both projects are VB). The first project contains only some public constant definitions (for the moment) and compiles into...
2
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property....
3
by: Lance | last post by:
I have a situation where I want to show a property when one object is selected in a PropertyGrid, but I want to hide that property when more than one object is selected. For example, lets say I have...
0
by: Tom Shelton | last post by:
On 2008-04-24, J-L <alphomega_sansca_@free.frwrote: I believe if you apply the BrowseableAttribute set to false to the property, then it won't show in the property grid: public in...
0
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
Assuming you mean a control which has a runtime only property, then apply the following attribute to the property: -- Ciaran O''Donnell http://wannabedeveloper.spaces.live.com
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.