We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

A non-exclusive combo box using a Data Source

Thread ID:





4199 May 2,2003 01:39 PM UTC May 2,2003 07:19 PM UTC WinForms 3
Tags: GridControl
Brenda Maloff
Asked On May 2, 2003 01:39 PM UTC

I have a grid with a combo box on it that has ExclusiveChoice set to false. I'm binding this to a data table with the DataSource and I have a DisplayMember column that is a string and a ValueMember column that is an int. Now when I'm using this combo box, if I select a value out of the list, I'm fine. However when I type in a value not in the list and then leave the cell, the cell appears as if the text is doubled up and offset. If the ValueMember column is a string I do not get this behavior. Is there a way that I can leave the ValueMember column as an int and not get this weird looking text happening when I type in a value that is not in the list?

Administrator [Syncfusion]
Replied On May 2, 2003 02:28 PM UTC

What is the CellValueType of that column? Can you make it be typeof(string)? One reason you might get this shadowed text is because the grid tries to convert the text to an int and that fails. Stefan

Brenda Maloff
Replied On May 2, 2003 03:23 PM UTC

I know the reason I'm getting shadowed text is because of the conversion...if I enter "123" I'm fine, but if I enter "abc" I get the shadowed text. I tried making the CellValueType of type string but to no avail, I get the same thing happening.

Administrator [Syncfusion]
Replied On May 2, 2003 07:19 PM UTC

One way you can do this is to dynamically add new entries to the datasource of the combobox. You can do this in CurrentCellValidating. In your handler, you can check if the new value is not a number. If it is not, check the datasource to see if the new item is in the displaymember. If it is not, add it to the datatable. Attached is a little sample. With the upcoming 1.6 release, there are formatting events that you could handle and probably avoid this problem without having to dynamically build your comboboxes data source.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon