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.
Unfortunately, activation email could not send to your email. Please try again.

GridControl combobox

Thread ID:

Created:

Updated:

Platform:

Replies:

79065 Jan 19,2009 11:58 AM Jan 20,2009 08:31 AM Windows Forms 2
loading
Tags: GridControl
Markus Persson
Asked On January 19, 2009 11:58 AM

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 07:20 AM

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"
dt.Rows.Add(dr)
dr = dt.NewRow()
dr("Value") = "2"
dr("Display") = "No"
dt.Rows.Add(dr)
dr = dt.NewRow()
dr("Value") = "3"
dr("Display") = "Maybe"
dt.Rows.Add(dr)

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 08:31 AM

Hi Markus,

Thanks for sharing information with us.

Please let us know any other concerns.

Regards,
Nisha.


CONFIRMATION

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.

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.

;