Winforms ComboBox Databind with DropDownStyle=Dropdown


Winforms / .Net 3.5

I am using a combobox with the dropdownstyle set to dropdown (allows users to enter data).

The problem I am having is with how to setup the combobox so it updates my bindingsource with values from the list and also when a user enters data.

For example the combobox may contain the following values:

"Red", "White", "Blue". But the user should be able to enter "Black".

I tried using the "Text" property but the problem is my combobox display values include extra information (code and a description) than the Value (only code).

I tried using SelectedValue when adding bindings to the combobox, but then it only updates with values from the list and not when a user enters data.

MyComboBox.DataBindings.Add("SelectedValue", MyBindingSource, "MyProperty", True, DataSourceUpdateMode.OnValidation)

Any ideas?


I had the same problem. I solved it by replacing the parameter "SelectedValue" with "Text" in DataBindings.Add method. MyComboBox.DataBindings.Add("Text", MyBindingSource, "MyProperty", True, DataSourceUpdateMode.OnValidation)


Try changing the DropDownStyle property off of your ComboBox. Not sure if it will give you what you want but it is a new direction to look in.


In your validating event, if the text.isNullOrEmpty()==fallse && selectedItem==null or selectedIndex<0

<ol><li>check if an item with that name already exists in the collection and change the selectedItem to that if so.</li> <li>Prompt the user for if they meant to try to create a new item.</li> <li>Do whatever you need to get the information for creating that item, wether it's displaying a form dialog, or nothing at all.</li> <li>Insert the newly created instance into the datasource the comboBox is bound to.</li> <li>Set the selectedItem property on the comboBox to the new Item.</li> </ol>


  • PHP shell_exec running a shellscript with ssh
  • Lucene Query Boosting
  • Unpickling mid-stream (python)
  • Converting a PEM private key file to a JAVA PrivateKey Object
  • too many characters in character literal in asp.net c#
  • How to implement cascading DropDownList ASP.Net control? [closed]
  • ASP.NET Gridview Paging Problem
  • update record in database using jdatabase
  • AlertDialog style when using setView()
  • Data Access from Entity framework works during debugging but not on live
  • HTML5 video only works in IE. The other browsers shows the black screen
  • jQuery: add elements until a particular height is reached
  • AndEngine Applying Transparancy to AndEngine View
  • Reduction and collapse clauses in OMP have some confusing points
  • How can the INSERT … ON CONFLICT (id) DO UPDATE… syntax be used with a sequence ID?
  • QLPreviewController hide print button in ios6
  • Database structure design with variable amounts of fields
  • Meteor helpers not available in Angular template
  • Projection media query: browser support and workarounds?
  • JFileChooser in front of fullscreen Swing application
  • Uncaught Error: Could not find module `ember-load-initializers`
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Validaiting emails with Net.Mail MailAddress
  • MySQL WHERE-condition in procedure ignored
  • Why is the timeout on a windows udp receive socket always 500ms longer than set by SO_RCVTIMEO?
  • Web-crawler for facebook in python
  • R: gsub and capture
  • Unit Testing MVC Web Application in Visual Studio and Problem with QTAgent
  • Buffer size for converting unsigned long to string
  • trying to dynamically update Highchart column chart but series undefined
  • Acquiring multiple attributes from .xml file in c#
  • Hits per day in Google Big Query
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • How to get Windows thread pool to call class member function?
  • How can I remove ASP.NET Designer.cs files?
  • Checking variable from a different class in C#
  • java string with new operator and a literal