Simple DataBinding Problem

  • Thread starter Thread starter Davie
  • Start date Start date
D

Davie

How can I bind the following to a comboBox in the compact framework? I'm
looking at this example here:
http://samples.gotdotnet.com/quicks...rl=/quickstart/winforms/doc/WinFormsData.aspx

When I do the following, i just get the application name appearing in the
ComboBox.

Thanks in advance.




struct comboItem
{
private string name;
private string id;

public string Name
{
get{ return name; }
}
public string Id
{
get{ return id; }
}

public comboItem(string name, string id)
{
this.name = name;
this.id = id;
}
}

//create the items
comboItem[] items= new comboItem[3];
items[0] = new comboItem("London", "567567");
items[1] = new comboItem("Paris", "34535");
items[2] = new comboItem("Glasgow", "12312");

//bind to comboBox1
this.comboBox1.DataSource = items;
this.comboBox1.DisplayMember = "name";
this.comboBox1.ValueMember = ="id";
 
Hi Davie,

In .NET compact framework, the code is the same as in .NET framework. I
tried your code on my machine. It works fine on the emulator.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks for your reply Kevin.

I have tried my code on a Desktop application and it works, when i come to
run this on smarpthone however I only get the name of the application
appearing in my combobox and not the desired result. I'm still using VS
2003 with the emulator and I've also tried it on my Smartphone 2003 device.
Both are still showing me the application name.

Do you have any other suggestions ?

Many thanks.
 
Problem solved.

Thanks.



Davie said:
Thanks for your reply Kevin.

I have tried my code on a Desktop application and it works, when i come to
run this on smarpthone however I only get the name of the application
appearing in my combobox and not the desired result. I'm still using VS
2003 with the emulator and I've also tried it on my Smartphone 2003
device. Both are still showing me the application name.

Do you have any other suggestions ?

Many thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top