User Control Properties

G

Guest

I have a user control with two boolean properties (AutoFit and AutoSize).
Both can be set at design time but both cannot be True. How can I code this
so that at Design Time, when the user sets one to True, the other is toggled
to False.? I'm new to using Design Time Property Editors so would appreciate
any help.
 
P

Peter Proost

Hi

this could help:

don't forget that in your constuctor you'll have to set one of the two
booleans to true

hth Peter

Private blnAutoFit, blnAutoSize As Boolean

Public Property AutoFit() As Boolean
Get
Return blnAutoFit
End Get
Set(ByVal Value As Boolean)
blnAutoFit = Value
blnAutoSize = Not Value
End Set
End Property

Public Property MyAutoSize() As Boolean
Get
Return blnAutoSize
End Get
Set(ByVal Value As Boolean)
blnAutoSize = Value
blnAutoFit = Not Value
End Set
End Property
 
G

Guest

Yes this works when the application is run but at Design time, it doesn'
reset one to False when both are set to true in the Properties Window. I am
trying to get them to change the design time property window such that if one
is set to True and the use sets the other to True, the first one changes to
False.
 
P

Peter Proost

Hi Dennis,

with me that does work even at design time, have you tested it?

Greetz Peter
 
G

Guest

Yes, this is what I had originally but I still can set both to True at Design
Time then at run time, it resets the AutoFitColumn to False when it runs.
I'll keep trying. Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top