473,573 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11286
Steve,

In .NET 1.1 and before, you want to create an event of type EventHandler
named <property>Chang ed. 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 INotifyProperty Changed 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.co m

"Steve Teeples" <St**********@d iscussions.micr osoft.com> wrote in message
news:80******** *************** ***********@mic rosoft.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
PropertyValueCh anged 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>Chang ed. 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 INotifyProperty Changed 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.co m

"Steve Teeples" <St**********@d iscussions.micr osoft.com> wrote in message
news:80******** *************** ***********@mic rosoft.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 Recognized Expert Specialist
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
2087
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 a bitmap ok, but when I want to delete it, I cannot do it. For example, in Visual Studio when you set the background image for a form, you can...
0
5425
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 "ctlFirstName", and it's bound to the "FirstName" property of "Person". Why doesn't the following work? myForm.Show(); Person p = new Person();
2
14308
by: X.W. | last post by:
Hi group, I have a class like this: class Person { public uint Age { get{...} set{...} }
7
9702
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
3813
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 class libarary. The second one is builds an executable which has a reference to the assembly of the first project to retrieve global constant...
2
4831
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. But, for complex property types (e.g., instance types) this does not work because System.ComponentModel.DefaultValue requires a constant value In...
3
2817
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 an object with a Name property that must be unique. If one of these objects is selected by a PropertyGrid, then I want to show the Name property in...
0
235
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 MyProperty{get;set;} HTH
0
1276
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
7750
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7989
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8182
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7744
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8039
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6369
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5559
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5271
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2170
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.