Databinding ComboBox in Windows Form




Hey all,

I'm trying to create a Combobox that show the contents of a data table,
in a Windows Form. It's a Managed C++ project BTW.

I'm creating a DataTable (through an XML schema) with two elements

I've created a DataTable "members" with columns

ID UnsignedInt
name String

I've set the Combo properties (from the .NET 2003 Studio IDE)

DataSource to myDataSet.members
ValueMember to ID
DisplayValue to String


The DataTable is initially empty. I can add rows to the datatable just
fine. How do I make the Combobox display all the "name" values? I tried
Refresh() and Update(). If I remove the databinding I can populate the box
with Add(), but I'm not sure how to make this work with databinding.


Perhaps I'm misunderstanding how databinding is supposed to work? Also,
I'm a bit new with databases and Windows Forms, so if I misstated
something please forgive me.



that guy

.



Relevant Pages

  • Databinding ComboBox in Windows Form
    ... in a Windows Form. ... How do I make the Combobox display all the "name" values? ... but I'm not sure how to make this work with databinding. ...
    (microsoft.public.dotnet.framework.adonet)
  • Databiinding to Combobox
    ... I am using Databinding to fill a Combobox Display and Value members with ... Combobox loads with form from .sdf file ... reloading the databinding every time I fire any event on the form. ... I've traced the event, the "index" change is first, the selected index, then ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ComboBox ItemData?
    ... not clear why you couldn't use complex databinding to accomplish it. ... > fill a combobox with those values. ... >>> The idea with the comboboxes was to use them as lists of choosable ... > private void InitializeComponent() ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: ComboBox ItemData?
    ... The only thing I saw in your code is that you are using "simple" databinding ... as you did for the cmbBoxItems combobox: ... > private void InitializeComponent() ... > this.comboBox2.Items.Add("Detta är objekt 1"); ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Databiinding to Combobox
    ... when something was selected (but not during initial loads... ... Which leads on to another post for tomorrow about DataBinding. ... >> Combobox loads with form from .sdf file ... it fires ...
    (microsoft.public.dotnet.framework.compactframework)