Skip to content

Use LookupEdit and GridLookupEdit controls in combobox mode.

License

Notifications You must be signed in to change notification settings

DevExpress-Examples/winforms-data-lookups-combobox-mode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WinForms Lookup Editors - Combobox mode

This example shows how to use LookupEdit and GridLookupEdit controls in combobox mode. In this mode, users can type in the text box and enter values that are not in the data source.

In this example, the LookupEdit is bound to an array of strings. The GridLookupEdit is bound to a list of business objects.

Do the following to enable the Combobox Mode:

  • Set the Properties.TextEditStyle property to TextEditStyles.Standard to allow users to type in the text box.

  • Set the GridLookUpEdit control's ValueMember and DisplayMember properties to the same data field (with string values). For the LookUpEdit, these proprties are not specified (set to an empty string).

    gridLookUpEdit1.Properties.ValueMember = "ProductName";
    gridLookUpEdit1.Properties.DisplayMember = gridLookUpEdit1.Properties.ValueMember;
  • Enable the AcceptEditorTextAsNewValue options property, which enables users to enter custom text in the edit box.

  • Handle the ProcessNewValue event to parse entered values and add new records to the lookup’s data source.

Read the following help topic for more information: ComboBox Mode - Enter New Values.

Files to Review

Documentation

See Also

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)