다음을 통해 공유


Adding Values to a Combo Box Control

You can add values to a combo box control as long as you have the Dialog editor open.

Tip

It's a good idea to add all values to the combo box before you size the box in the Dialog editor, or you may truncate text that should appear in the combo control.

To enter values into a combo box control

  1. Select the combo box control by clicking on it.

  2. In the Properties Window, scroll down to the Data property.

    Note

    If you are displaying properties grouped by type, Data appears in the Misc properties.

  3. Click in the value area for the Data property and type in your data values, separated by semicolons.

    Note

    Do not put spaces between values because spaces interfere with alphabetizing in the drop-down list.

  4. Click Enter when you are finished adding values.

For information on enlarging the drop-down portion of a combo box, see Setting the Size of the Combo Box and Its Drop-Down List.

Note

You cannot add values to Win32 projects using this procedure (the Data property is grayed out for Win32 projects). Because Win32 projects do not have libraries that add this capability, you must add values to a combo box with a Win32 project programmatically.

To test the appearance of values in a combo box

  • After entering values in the Data property, click the Test button on the Dialog Editor Toolbar.

    Try scrolling down the entire value list. Values appear exactly as they are typed in the Data property in the Properties window. There is no spelling or capitalization checking.

    Press ESC to return to the Dialog box editor.

For information on adding resources to managed projects, please see Resources in Applications in the .NET Framework Developer's Guide. For information on manually adding resource files to managed projects, accessing resources, displaying static resources, and assigning resources strings to properties, see Walkthrough: Localizing Windows Forms and Walkthrough: Using Resources for Localization with ASP.NET.

Requirements

Win32

See Also

Reference

Controls in Dialog Boxes

Concepts

Controls (MFC)