Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help
Message
From
06/07/2002 14:29:56
 
 
To
All
General information
Forum:
Visual Basic
Category:
ActiveX controls
Title:
Help
Miscellaneous
Thread ID:
00675880
Message ID:
00675880
Views:
46
Is there a way that you can change the Style property in visual basic when creating a control so that when you put it on a form you don't get a runtime error stating "Property can't be assigned read-only". I want to give the user the ablity to be able to change the style of a command button, to either (0-Standard) or (1-Graphic), when the put the control I'm creating on a form. Here is the code that I have for it so far.

Public Property Get BtnStyle() As ButtonConstants
BtnStyle = btn.Style
End Property

Public Property Let BtnStyle(ByVal NewStyle As ButtonConstants)
btn.Style = NewStyle
UserControl.PropertyChanged "BtnStyle"
End Property

Private Sub UserControl_InitProperties()
BtnStyle = vbButtonStandard
End Sub

Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "BtnStyle", BtnStyle, vbButtonStandard
End Sub

Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
BtnStyle = PropBag.ReadProperty("BtnStyle", vbButtonStandard)
End Sub


Any help would be appreciated.
Next
Reply
Map
View

Click here to load this message in the networking platform