473,320 Members | 1,909 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Object Data Binding

Lets say i have an array of order objects and I wish for these objects to be
bound to a ComboBox.

public order(string id, string name, int price, string details)

order[] orders = new ...........
I know that i can bind them to a combobox by doing the following:
comboBox1.DataSource=orders;
comboBox1.DisplayMember="name";
comboBox1.ValueMember="id";
How can I set the display member to be the name element of the object and
the ValueMember be the actual object?

Many thanks.
Nov 17 '05 #1
2 1591
Solved this problem thanks.
"Davie" <Da***@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Lets say i have an array of order objects and I wish for these objects to
be bound to a ComboBox.

public order(string id, string name, int price, string details)

order[] orders = new ...........
I know that i can bind them to a combobox by doing the following:
comboBox1.DataSource=orders;
comboBox1.DisplayMember="name";
comboBox1.ValueMember="id";
How can I set the display member to be the name element of the object and
the ValueMember be the actual object?

Many thanks.

Nov 17 '05 #2
Davie,

It is good idea to provide your solution for the archive in case that
someone in future has the same problem.

Thanks
Stoitcho Goutsev (100) [C# MVP]

"Davie" <Da***@newsgroup.nospam> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
Solved this problem thanks.
"Davie" <Da***@newsgroup.nospam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
Lets say i have an array of order objects and I wish for these objects to
be bound to a ComboBox.

public order(string id, string name, int price, string details)

order[] orders = new ...........
I know that i can bind them to a combobox by doing the following:
comboBox1.DataSource=orders;
comboBox1.DisplayMember="name";
comboBox1.ValueMember="id";
How can I set the display member to be the name element of the object and
the ValueMember be the actual object?

Many thanks.


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
15
by: Tim Jarvis | last post by:
Hi, I have an object that I am binding to a text box, this object exposes a boolean field, and I have implemented a format event handler and a parse event handler for the binding object, where I...
19
by: Simon Verona | last post by:
I'm not sure if I'm going down the correct route... I have a class which exposes a number of properties of an object (in this case the object represents a customer). Can I then use this...
18
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
16
by: D Witherspoon | last post by:
I am developing a Windows Forms application in VB.NET that will use .NET remoting to access the data tier classes. A very simple way I have come up with is by creating typed (.xsd) datasets. For...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.