'Text' Property is Read-Only Error as Set Combo Box Text Prop

Last reviewed: June 21, 1995
Article ID: Q84056
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SUMMARY

If you assign a value to the Text property of a combo box with Style=2 (Dropdown list), you will receive a

   'Text' property is read-only

error message. To assign a default value to a combo box with the Style property set to 2, you need to set the ListIndex property of the combo box. If you assign a value to the Text property of a combo box with Style set to 0 (Dropdown Combo) or 1 (Simple Combo), you will not get the above error message.

MORE INFORMATION

A combo box combines the features of a text box and a list box. The user can make a selection by selecting an item from its list or by entering text in the text box portion of the combo box at the top of the combo box.

If the Style property is set to 0 (Dropdown Combo) or 1 (Simple Combo), the user can select an item in the list or enter text in the text portion of the combo box. The text entered may or may not be an item in the list. A default value for the combo box can be set either by assigning a value to the ListIndex property or by assigning a value to the Text property of the combo box.

However, if the Style property is set to 2 (Dropdown List), the user can only select an item from the list. The user cannot enter text directly in the text portion of the combo box. Therefore, a default item for the combo box can be set by assigning a value to the ListIndex property. The Text property of a combo box with Style set to 2 (Dropdown List) is read-only.

REFERENCES

"Microsoft Visual Basic: Language Reference," version 1.0, page 311


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg
KBSubcategory: PrgCtrlsStd


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.