conditional ReadOnly Property

Ste_Moore01

Member
Joined
Aug 12, 2013
Messages
6
Programming Experience
3-5
Hi,

I'm creating a UserControl where there are 2 properties, Resizable and ResizeType.

Resizable is a boolean and ResizeType is an integer.

I want ResizeType to be readonly if Resizable is False and writeable if it is True

Is this possible?
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
You can't change whether the property is ReadOnly or not while the program is running, that's a compile time declarative.
What you can do is in the Set part of the ResizeType property is check the Resizeable property to determine whether you accept the new value or not.
 

Ste_Moore01

Member
Joined
Aug 12, 2013
Messages
6
Programming Experience
3-5
I thought that may be the case and I have done, I was just hoping that I could change it at runtime.

Thanks
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,380
Location
Norway
Programming Experience
10+
Although complex a lot can be done with design-time support, looking through these documents may get you some ideas: Extending Design-Time Support

It may be better to make ResizeType property an Enum type and add None as option (FormBorderStyle property is an example of this).
 
Top Bottom