User Control Properties

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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.
 
Hi Dennis,

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

Greetz Peter
 
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.
 
Back
Top