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

load ComboBoxBase from xml

Thread ID:

Created:

Updated:

Platform:

Replies:

55291 Jan 26,2007 03:59 PM UTC Jan 31,2007 07:51 PM UTC WinForms 3
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 26, 2007 03:59 PM UTC

Hi,
I'm trying to load data into a ComboBoxBase using this code. I only get one row. The samples only have mdb data sources. I would ultimately like the choice picked in the combo to drive the items displayed in adjacent text boxes, so that I have a kind of record browser.

Can you help?

Thanks,

this.dsList = new DataSet();
this.dsList.ReadXml("List.xml");
this.cmbPortfolios.DataBindings.Add("Text", this.dsList.Tables["Lists"], "description");

Administrator [Syncfusion]
Replied On January 29, 2007 05:43 PM UTC

Hi Dimitri.

The Combobox doesn't have a DataMember property - instead it has a DisplayMember and ValueMember property. The DisplayMember of a Combobox gets or sets a string that specifies the property of the data source whose contents you want to display. The ValueMember property determines which value gets moved into the SelectedValue of the Combo Box.

In the example, whenever the user selects a Customer by "Customers.CompanyName", the SelectedValue is the "Customers.CustomerID". Whenever the SelectedValue changes, the data-binding moves the new value into the Customer object.

// Setup the combobox view and display-, value member
comboBox.DataSource = dsView;
comboBox.DisplayMember = "Customers.CompanyName";
comboBox.ValueMember = "Customers.CustomerID";

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 30, 2007 02:09 PM UTC

Thanks Haneef,
The examples use a database - I'm not having a lot of luck using xml - is there a sample driven totally by xml?



>Hi Dimitri.

The Combobox doesn't have a DataMember property - instead it has a DisplayMember and ValueMember property. The DisplayMember of a Combobox gets or sets a string that specifies the property of the data source whose contents you want to display. The ValueMember property determines which value gets moved into the SelectedValue of the Combo Box.

In the example, whenever the user selects a Customer by "Customers.CompanyName", the SelectedValue is the "Customers.CustomerID". Whenever the SelectedValue changes, the data-binding moves the new value into the Customer object.

// Setup the combobox view and display-, value member
comboBox.DataSource = dsView;
comboBox.DisplayMember = "Customers.CompanyName";
comboBox.ValueMember = "Customers.CustomerID";

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 31, 2007 07:51 PM UTC

Hi Dimitri,

Please try the sample and let me know if you are looking something different.
comboBox.zip

Best Regards,
Haneef

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.

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

;