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

GridControl combobox

Thread ID:





79065 Jan 19,2009 04:58 PM UTC Jan 20,2009 01:31 PM UTC WinForms 2
Tags: GridControl
Markus Persson
Asked On January 19, 2009 04:58 PM UTC

I know that I can use:

Me.GridControl1.ColStyles(1).DataSource = ' A DS
Me.GridControl1.ColStyles(1).DisplayMember = "" ' A column in the DS
Me.GridControl1.ColStyles(1).ValueMember = "" ' Another column in the DS

To get a combobox on my GC to display text but save other values (numbers) to the database. This works perfectly.

But is it possible to have "DisplayMember" and "ValueMember" if I don't have a DataSource?

For example, if I have a StringCollection with "Yes", "No" and "Maybe". But I want it to save the values "1", "2" or "3" to the database and not "Yes", "No" or "Maybe".

Markus Persson
Replied On January 20, 2009 12:20 PM UTC

I solved my problem by creating a DataTable:

Dim dt As DataTable = New DataTable()
Dim dr As DataRow

dt.Columns.Add(New DataColumn("Value", Type.GetType("System.String")))
dt.Columns.Add(New DataColumn("Display", Type.GetType("System.String")))

dr = dt.NewRow()
dr("Value") = "1"
dr("Display") = "Yes"
dr = dt.NewRow()
dr("Value") = "2"
dr("Display") = "No"
dr = dt.NewRow()
dr("Value") = "3"
dr("Display") = "Maybe"

Me.GridControl1.ColStyles(1).DataSource = dt Me.GridControl1.ColStyles(1).DisplayMember = "Display" Me.GridControl1.ColStyles(1).ValueMember = "Value"

Nisha Arockiya A [Syncfusion]
Replied On January 20, 2009 01:31 PM UTC

Hi Markus,

Thanks for sharing information with us.

Please let us know any other concerns.



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