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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Displaying one value and showing another in a ComboBox

Thread ID:





56413 Feb 14,2007 05:37 PM UTC Feb 14,2007 07:04 PM UTC WinForms 2
Tags: GridControl
Administrator [Syncfusion]
Asked On February 14, 2007 05:37 PM UTC

I am trying to use a combobox to display one value but save another using the example in the documentation...

Private Sub Form1_Load(sender As Object, e As System.EventArgs)
Me.gridDataBoundGrid1.DataSource = PrimaryTable
Me.gridDataBoundGrid1.EnableAddNew = False

Dim gbc As GridBoundColumn = Me.gridDataBoundGrid1.Binder.InternalColumns(1)
gbc.StyleInfo.CellType = "ComboBox"
gbc.StyleInfo.DataSource = ForeignKeyTable
gbc.StyleInfo.DisplayMember = "Name"
gbc.StyleInfo.ValueMember = "CustID"
gbc.StyleInfo.ShowButtons = GridShowButtons.ShowCurrentRow
gbc.StyleInfo.HorizontalAlignment = GridHorizontalAlignment.Left
End Sub

The combobox works as long as there is a match with a match against the "DisplayMember." When there isn't a match, the grid adds the entered text to the foreign key column of the PrimaryTable which is not desired. Is there a property I can check or an event that is raised in the later situation. Also, is there a way to make a combobox both editable and autocomplete at the same time.

Administrator [Syncfusion]
Replied On February 14, 2007 05:59 PM UTC

Hi Marc,

Here is a forum that discuss with the simillar issue.

Best regards,

Administrator [Syncfusion]
Replied On February 14, 2007 07:04 PM UTC

The forum you mentioned addresses the autocomplete problem not the other. I will re-emplain.

When the combobox "displaymember" matches the entered text, it adds the corresponding "valuemember" to the corresponding column in the the grid. This is the expected behavior.

When the combobox's "displaymember" does NOT match the entered text, there isn't a "valuemember." The combobox adds the "displaymember" instead but the datasource of the grid is expecting a foreign key. The datasource errors (unless the entered text is a foreign key).

Is their a way to find out before the combobox writes the value to the grids datasource?


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

or the page will be automatically redirected to 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