General information
Category:
ActiveX controls
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only