473,320 Members | 1,841 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.

build and assign an array to a combo box

How di I dynamically build and 2 dimensional array and assign this array
to a combobox. 1 item will be the displayed details and the other is
the value I need returned.
Nov 13 '06 #1
1 2006
You can add any object to a listbox, even classes. For example:

class Product
{
private int ProductID;
private string ProductName;

public Product(int productid, string productname)
{
this.ProductID = productid;
this.ProductName = productname;
}
}

Product myProduct = new Product(5343, "Car");

ListBox.Items.Add(myProduct);

Product selectedProduct = ListBox.SelectedItem() as Product;

hope you find it useful

"Jeff Williams" <je***********@hardsoft.com.auschreef in bericht
news:12*************@corp.supernews.com...
How di I dynamically build and 2 dimensional array and assign this array
to a combobox. 1 item will be the displayed details and the other is the
value I need returned.

Nov 13 '06 #2

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

Similar topics

48
by: yezi | last post by:
Hi, all: I want to record some memory pointer returned from malloc, is possible the code like below? int memo_index; int i,j; char *tmp; for (i=0;i<10;i++){
3
by: Shravan | last post by:
Hi, How can I bind DataRow array to ComboBox. I tried setting DataSource -> DataRow Array DisplayMember -> ColumnName But it was showing "System.Data.DataRow" for every item in the...
0
by: Yogi_Bear_79 | last post by:
I have a form with 30 text boxes on it. They are set up in three columns, and 10 rows. Each row equals one record in the array. What I want to do is start by reading the first box txtColumnA_1,...
26
by: Brett | last post by:
I have created a structure with five fields. I then create an array of this type of structure and place the structure into an array element. Say index one. I want to assign a value to field3 of...
0
by: XML newbie: Urgent pls help! | last post by:
how to store the names and their id's in the combo box and build an array from those selected. Please note in my GUI, I have a combobox that would have names. I need to pass in the I want to...
3
by: Ron | last post by:
Hi, If it's possible, a quick example would REALLY help. I'm clueless which makes me boxless as well. ::grin:: TIA ron
4
by: johnners | last post by:
Hi all I'm having trouble assigning an attribute to a namespace using nusoap/php when creating a new soapclient. I can get the soapclient to assign the parameters correctly but can't assign an...
2
by: lathamoulali | last post by:
In VB6.0 in Combobox , you can use the ItemData to assign a key to the combo box like With cbobox1 .AddItem "2D Bar" .ItemData(ChartTypeComboBox.NewIndex) = VtChChartType2dBar end with ...
2
by: Akino877 | last post by:
Hello, I am new to HTML and PHP. And I am trying to assign an array of values to the <option value=...> of a combo list. But what I am trying to do is not working. I can sucessfully get it to...
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...
1
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.