PropertyGrid question
Messages   Related Types
This message was discovered on ASPFriends.com 'winforms-cs' list.


Shalhevet Golan
Hi All,

I'm using a propertyGrid and I wonder, is it possible to change a property
to be 'ReadOnly' in runtime ?

Like :
public String Name
{
    get {
        return name;
    }
}

but, sometimes i want the 'Name' to be editable (it depends on some
validations), so i need the 'set' as well.

does anyone has an idea to how to solve it ?

thanx,
Shalhevet.
Reply to this message...
 
    
Per Erik Lorentzen
Use a flag (PropertyIsEditable =3D true / false), and prevent the "field =
=3D value" in the Set property according to the flag's value.

Med hilsen
Per Erik Lorentzen
SK Data as
Click here to reveal e-mail address
----- Original Message -----=20
From: "Shalhevet Golan" <Click here to reveal e-mail address>
To: "winforms-cs" <Click here to reveal e-mail address>
Sent: Monday, July 29, 2002 6:58 PM
Subject: [winforms-cs] PropertyGrid question

[Original message clipped]

-------------------------------------------------------------------------=
-------

> =
-------------------------------------------------------------------------=
------------
[Original message clipped]

------------
[Original message clipped]

-------------------------------------------------------------------------=
-------

[Original message clipped]

Reply to this message...
 
    
Shalhevet Golan
Thanks, I tried it, but what happens is that I can write a value in the
field, but it doesn't get saved.
what I want is, if PropertyIsEditable = false, I will see the field value
as readonly, and not be able to type in it.

There is a 'Readonly' attribute, that does exactly what I need, but what I
need to figure out right now, is how to change the attribute value in
runtime from true to false and vice versa.

I have another question, do you know how to set the fields order in the
propertyGrid, right now it is set alphabetically, I want to be able to
control the fields display order.

-----Original Message-----
From: Per Erik Lorentzen [mailto:Click here to reveal e-mail address]
Sent: Thursday, August 01, 2002 08:22 AM
To: winforms-cs
Subject: [winforms-cs] Re: PropertyGrid question

Use a flag (PropertyIsEditable = true / false), and prevent the "field value" in the Set property according to the flag's value.

Med hilsen
Per Erik Lorentzen
SK Data as
Click here to reveal e-mail address
----- Original Message -----
From: "Shalhevet Golan" <Click here to reveal e-mail address>
To: "winforms-cs" <Click here to reveal e-mail address>
Sent: Monday, July 29, 2002 6:58 PM
Subject: [winforms-cs] PropertyGrid question

[Original message clipped]

----------------------------------------------------------------------------
----

>
----------------------------------------------------------------------------
---------
[Original message clipped]

---------
[Original message clipped]

----------------------------------------------------------------------------
----

[Original message clipped]

| [winforms-cs] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/winforms-cs.asp = JOIN/QUIT
Reply to this message...
 
 
System.Windows.Forms.PropertyGrid




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com