Microsoft KB Archive/177094

= PRB: ActiveX Control Cannot Assign Run-Time Read-Only Property =

Article ID: 177094

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q177094



SYMPTOMS
When your Usercontrol attempts to expose a run-time read-only property of a constituent control, you get the following error:

Compile Error:

Can't Assign to Read-Only Property



CAUSE
The run-time read-only properties of constituent controls cannot be exposed.

Because properties of the UserControl object and constituent controls are exposed by delegation, you cannot expose design-time-only properties such as Appearance and ClipControls. The settings you choose for such properties will be fixed for your ActiveX control.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Start a new ActiveX Control project in Visual Basic. UserControl1 is created by default. Add a text box to UserControl1.  Copy the following code to the Code window of UserControl1: Option Explicit Property Let Multiline(b As Boolean) Text1.Multiline = b     End Property

Property Get Multiline As Boolean Multiline = Text1.Multiline End Property  Close UserControl1. Add a Standard EXE project to the project group by completing the following steps:

 From the File Menu, click Add Project. The Add Project dialog box displays.</li> Click Standard EXE and click Open to close the Add Project dialog box and open the Form1 form of the second project.</li></ol> </li> Add Usercontrol1 to Form1.</li> In the Properties window for the Usercontrol, attempt to set the MultiLine property to True and note that you receive the compile error described above.</li></ol>

<div class="references_section">