Insert a combo box - Microsoft Support (2024)

A combo box is a text box with a list box attached. This type of control enables users to select a predefined value in a list or type their own value in the text box portion of the control. The list is hidden until the user clicks the arrow next to the box.

In this article

  • When to use a combo box

  • The user experience

  • Compatibility considerations

  • Insert a combo box

  • Layout tips

When to use a combo box

Use a combo box when you want to:

  • Enable users to either select a predefined value from a list of choices or type their own value.

  • Hide list items on the form by default.

  • Display values retrieved from a fixed list, from the form template's data source, or from an external data source, such as a database or Microsoft Windows SharePoint Services list.

In the following illustration, users categorize expenses in an expense report form by selecting values in a combo box. If they don't see the value that they need, they can type it in the box instead of selecting a value in the list. In this example, the user is in the process of typing the words Phone/Fax.

Insert a combo box - Microsoft Support (1)

After you insert a combo box on your form template, you must specify the values that you want to appear in it. Otherwise, users will see an empty list when they click the arrow next to the combo box. In the Combo Box Properties dialog box, you can type the entries yourself or configure the combo box to retrieve entries from a database or other data source.

Related controls

Microsoft Office InfoPath includes other controls that are similar to combo boxes but that serve different purposes. To decide which of these controls works best on your form template, refer to the following list:

List boxLike a combo box, a list box allows users to select values in a list. However, users cannot add their own values to a list box. Also, a list box displays all of the items in the list, whereas the items in a combo box are hidden until the user clicks the control. If you plan to offer the user many choices in your control, list boxes may take up too much space on your form template. In this scenario, a drop-down list box or combo box may be a better choice.

Drop-down list boxLike a combo box, a drop-down list box enables users to select a value in a list that is hidden on the form by default. However, with a drop-down list box, users cannot add items to the list as they can with a combo box.

Multiple-selection list boxIf you want users to be able to choose more than one item in a list, you can use a multiple-selection list box. Multiple-selection list boxes look like two or more check boxes inside a scrollable list. Like a combo box, a multiple-selection list box enables users to add their own item to the list.

Option buttonsLike a combo box, a group of option buttons enables users to select from a list of mutually exclusive choices. However, with option buttons, users click a small circle to make a choice instead of clicking an item in a list box.

Top of Page

The user experience

Combo boxes are similar in appearance to drop-down list boxes, but they allow users to add their own item to the list, if necessary. If you manually typed your own list items in the Combo Box Properties dialog box when creating a combo box, InfoPath displays the text "Select or type..." as the default entry in the combo box. This lets users know that either action is acceptable. If the list items in the combo box display values from elsewhere on the form or from a secondary data source, the "Select or type..." text is omitted.

When users first open a form, the list items in a combo box are hidden. To open the list, users click an arrow on the right side of the combo box. They can then click an item to select it.

Insert a combo box - Microsoft Support (2)

If users don't see an appropriate list item, they can click in the box and type their own value.

Top of Page

Compatibility considerations

When you design a form template in InfoPath, you can choose to design a browser-compatible form template. When you design a browser-compatible form template, combo box controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser.

Top of Page

Insert a combo box

The procedure for inserting a combo box differs slightly depending on whether you are designing a new, blank form template or basing the design of your form template on a database or other external data source.

The following illustration shows how a combo box looks when it is selected in design mode.

Insert a combo box - Microsoft Support (3)

Controls can be bound or unbound. When a control is bound, it is connected to a field or group in the data source so that data entered into the control is saved in the underlying form (.xml) file. When a control is unbound, it is not connected to a field or group, and data entered into the control is not saved. When you select or move your pointer over a control, text and a binding icon appear in the upper-right corner of the control. The text indicates the group or field to which the control is bound in the data source. The icon indicates whether the control is correctly bound to that group or field. When the binding is correct, a green icon appears. If there's something wrong with the binding, you'll see a blue or red icon instead.

The data source for the form template consists of fields and groups that appear in a hierarchical view in the Data Source task pane. Combo boxes are always bound to fields. In the following example, the Category combo box on the form template is bound to the category field in the Data Source task pane.

Insert a combo box - Microsoft Support (4)

When you design a new, blank form template, the Automatically create data source check box in the Controls task pane is selected by default. This enables InfoPath to automatically create fields and groups in the data source as you add controls to the form template. These fields and groups are represented by folder and file icons in the Data Source task pane.

If you base the design of your form template on an existing Extensible Markup Language (XML) file, database, or Web service, InfoPath derives the fields and groups in the Data Source task pane from that existing data source.

Insert a combo box

  1. On the form template, place the cursor where you want to insert the control.

  2. If the Controls task pane is not visible, click More Controls on the Insert menu, or press ALT+I, C.

  3. In the Controls task pane, do one of the following:

    • To automatically create a field in the data source that is bound to the list box, select the Automatically create data source check box.

    • To bind the list box to an existing field, clear the Automatically create data source check box.

      Note:If the check box is unavailable, the data source is locked. For example, if you base the design of your form template on an XML Schema, you may not be able to add new fields or groups to the data source in InfoPath. This restriction helps to prevent you from inadvertently making changes to the schema that may render it invalid.

  4. Under Insert controls, click Combo Box.

  5. If you cleared the Automatically create data source check box in step 3, select a field in the Combo Box Binding dialog box to which you want to bind the list box.

  6. To add a label to the control, type text above or to the left of the control, followed by a colon (:).

  7. To specify the values that you want to use as the entries in the list, double-click the combo box.

  8. Click the Data tab.

  9. Do one of the following to populate the combo box:

    Type the list box values yourself

    This option is useful when you have a predetermined, limited set of values, and you don't expect those values to change in the future. If the values do happen to change, you must publish an updated version of your form template so that users can see and use the latest list entries.

    1. Click Add.

    2. In the Value box, type the text that you want to store if a user selects this entry.

    3. In the Display name box, type the text that you want to display for this entry, and then click OK.

    4. Repeat steps 1 through 3 for each entry that you want to add to the list box.

    5. To test your changes, click Preview on the Standard toolbar, or press CTRL+SHIFT+B.

    Use values from another part of the form

    This option is useful when you want the values in your list to change, depending on other values that the users enter into their form.

    1. Under List box entries, click Look up values in the form's data source.

      The entries in the list box must be associated with a particular repeating group or repeating field on your form template.

    2. Click Select XPath Insert a combo box - Microsoft Support (5)next to the Entries box, and then in the Select a Field or Group dialog box, click the repeating field or repeating group that contains the fields that will provide the values for the list box, and then click OK.

    3. Click Select XPath Insert a combo box - Microsoft Support (6)next to the Value box, click the field that contains the possible values for the items in the list box, and then click OK. One of these values will be saved in the underlying XML when a user clicks an item in the list box.

    4. Click Select XPath Insert a combo box - Microsoft Support (7)next to the Display name box, click the field that contains the values that are displayed in the list box, and then click OK.

      Tip:To prevent display name values from appearing multiple times in the list box, select the Show only entries with unique display names check box.

    Use values from a database, Web service, XML document, or SharePoint site

    This option is useful when you want the values in a list box to be up-to-date or refreshed regularly. The values are typically stored in a database or other external data source and are retrieved every time the form is opened.

    1. Click Look up values from an external data source.

    2. Do one of the following:

      • If you already added a data connection, click it in the Data Connection box.

      • To add a new data connection, click Add, and then follow the instructions in the Data Connection Wizard.

        The entries in the list box must be associated with a particular repeating field or repeating group.

    3. Click Select XPath Insert a combo box - Microsoft Support (8)next to the Entries box, and then in the Select a Field or Group dialog box, click the group or field that contains the fields that will provide the values for the list box, and then click OK.

    4. Click Select XPath Insert a combo box - Microsoft Support (9)next to the Value box, click the field that contains the possible values for the items in the list box, and then click OK. One of these values will be saved in the underlying XML when a user clicks an item in the list box.

    5. Click Select XPath Insert a combo box - Microsoft Support (10)next to the Display name box, click the field that contains the values that are displayed in the list box, and then click OK.

      Tip:To prevent display name values from appearing multiple times in the list box, select the Show only entries with unique display names check box.

Top of Page

Layout tips

Use the following tips to help you refine the appearance, size, and other aspects of a combo box control:

  • Consider widening the combo box so that it is a few spaces larger than the average width of the items in the list. That way, the list items aren't partially hidden.

  • To change the width of several combo boxes at once, select the combo boxes whose size you want to change, press ALT+ENTER, click the Size tab, and then in the Width box, type a new number.

  • To change the background color for several combo boxes at once, select the combo boxes that you want to change. On the Format menu, click Borders and Shading, and then make the necessary adjustments on the Shading tab.

  • To customize the font that appears in a combo box, use the Font and Font Size boxes on the Formatting toolbar. To change the font and font size for all of the combo boxes on your form template at once, click the combo box that contains the formatting that you want, and then on the Format menu, click Apply Font to All Combo Box Controls.

  • If you want to adjust the spacing between a combo box and the objects that surround it on the form template, you can adjust the margin settings in the Combo Box Properties dialog box (Size tab). Using margins to increase spacing offers a finer degree of control than using paragraph breaks to increase spacing.

Top of Page

Insert a combo box - Microsoft Support (2024)

FAQs

How do you insert a combo box in Word? ›

Under Insert controls, click Combo Box. If you cleared the Automatically create data source check box in step 3, select a field in the Combo Box Binding dialog box to which you want to bind the list box. To add a label to the control, type text above or to the left of the control, followed by a colon (:).

How do you add a combo box in power apps? ›

Select Insert > Input, and then select Combo box.

What is combo box in MS Access? ›

Combo box The combo box control provides a more compact way to present a list of choices; the list is hidden until you click the drop-down arrow. A combo box also gives you the ability to enter a value that is not in the list. In this way, the combo box control combines the features of a text box and a list box.

What is the difference between a combo box and a list box? ›

Generally, a combo box is appropriate when there is a list of suggested choices, and a list box is appropriate when you want to limit input to what is on the list. A combo box contains a text box field, so choices not on the list can be typed in.

How do I select a combo box? ›

You can get or set the combo box's selected item by using the SelectedItem property, and get or set the index of the selected item by using the SelectedIndex property. To get the value of a particular property on the selected data item, you can use the SelectedValue property.

How do combo box function? ›

A ComboBox displays a text box combined with a ListBox, which enables the user to select items from the list or enter a new value. The DropDownStyle property specifies whether the list is always displayed or whether the list is displayed in a drop-down.

What are the three types of combo box? ›

Three types of combo boxes are: standard, drop-down (the default), and drop-down list. Set the Style property to select the type of combo box you need: Use csDropDown to create an edit box with a drop-down list. Use csDropDownList to make the edit box read-only (forcing users to choose from the list).

How do I insert a checkbox in Word without the Developer tab? ›

How to insert a checkbox in Word
  1. Navigate to the "Symbols" section of the bullet point menu. First, click on the space in the document where you'd like the checkbox to appear. ...
  2. Select the "checkbox" option in "Symbols" ...
  3. Type your list using checkboxes.
Jun 24, 2022

What is the difference between a combobox and a drop-down list? ›

A drop-down list box saves space (it can drop down to cover other dialog box controls temporarily). A combo box allows the user either to select an item from the list or type in a new item.

What is the difference between the combo box and dropdown in power apps? ›

The combobox allows the user to pick a value from a predefined set or input a custom one. The dropdownlist only allows picking one of the predefined values.

How do I show selected items in combobox? ›

When you set the SelectedItem property to an object, the ComboBox attempts to make that object the currently selected one in the list. If the object is found in the list, it is displayed in the edit portion of the ComboBox and the SelectedIndex property is set to the corresponding index.

How to use combo box in CSS? ›

The Cambo Box create one class . select when you change the attribute background-color, for example, this property changes all Combo Box. So you need create the class . select option{ background-color: white; } to change only the list of options.

Top Articles
Latest Posts
Article information

Author: Kieth Sipes

Last Updated:

Views: 6328

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Kieth Sipes

Birthday: 2001-04-14

Address: Suite 492 62479 Champlin Loop, South Catrice, MS 57271

Phone: +9663362133320

Job: District Sales Analyst

Hobby: Digital arts, Dance, Ghost hunting, Worldbuilding, Kayaking, Table tennis, 3D printing

Introduction: My name is Kieth Sipes, I am a zany, rich, courageous, powerful, faithful, jolly, excited person who loves writing and wants to share my knowledge and understanding with you.