Nick
2004-04-27 07:11:50 UTC
Hi
I'm designing an ActiveX control which is basically a RichTextBox control
with a few extra properties and methods.
I've mapped most of the controls across from the RichTextBox to my control
except the Appearance property and the Scrollbars property. Both these
properties are read-only at runtime, which is what I want anyway. I simply
want these two properties to behave the same as if I was using just a
regular RichTextBox control.
I have 2 projects open in the IDE (VB6 SP3). One is the control (just a
RichTextBox), the other is a standard exe project with an instance of the
control on Form1. The standard exe project is set to startup.
I get a "Run-time error 383: Property is read only" error when I try to
change the Appearance property. If I remove the If Not Ambient....
statement, the error occurs when I simply open the form.
At no time am I running the project so why is it telling me I have a
run-time error?
I've tried using the Control Interface Wizard and it produces code which
causes the same error.
Thanks in advance
Nick
Public Property Let Appearance(ByVal conNew As
RichTextLib.AppearanceConstants)
If Not Ambient.UserMode Then
rtbEditor.Appearance = conNew 'fails on this line
PropertyChanged "Appearance"
End If
End Property
Public Property Get Appearance() As RichTextLib.AppearanceConstants
Appearance = rtbEditor.Appearance
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Appearance = PropBag.ReadProperty("Appearance", rtfThreeD)
'other properties omitted
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "AppearanceXXX", AppearanceXXX, rtfThreeD
'other properties omitted
End Sub
I'm designing an ActiveX control which is basically a RichTextBox control
with a few extra properties and methods.
I've mapped most of the controls across from the RichTextBox to my control
except the Appearance property and the Scrollbars property. Both these
properties are read-only at runtime, which is what I want anyway. I simply
want these two properties to behave the same as if I was using just a
regular RichTextBox control.
I have 2 projects open in the IDE (VB6 SP3). One is the control (just a
RichTextBox), the other is a standard exe project with an instance of the
control on Form1. The standard exe project is set to startup.
I get a "Run-time error 383: Property is read only" error when I try to
change the Appearance property. If I remove the If Not Ambient....
statement, the error occurs when I simply open the form.
At no time am I running the project so why is it telling me I have a
run-time error?
I've tried using the Control Interface Wizard and it produces code which
causes the same error.
Thanks in advance
Nick
Public Property Let Appearance(ByVal conNew As
RichTextLib.AppearanceConstants)
If Not Ambient.UserMode Then
rtbEditor.Appearance = conNew 'fails on this line
PropertyChanged "Appearance"
End If
End Property
Public Property Get Appearance() As RichTextLib.AppearanceConstants
Appearance = rtbEditor.Appearance
End Property
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
Appearance = PropBag.ReadProperty("Appearance", rtfThreeD)
'other properties omitted
End Sub
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
PropBag.WriteProperty "AppearanceXXX", AppearanceXXX, rtfThreeD
'other properties omitted
End Sub