473,385 Members | 1,764 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,385 software developers and data experts.

fill three combo boxes

Hi

I have a list of about 50 text items (strings) that I would like to add to
about 5 combo boxes at various times depending on if a user clicks on the OK
button.

I have tried to code an example such as:
String ArrayList arr = new arr {"cat","dog","pig"};
this.cbo1.Items.Add(arr); but this doesn't work for me.

and i have tried:

string[] arr = {"cat","dog","pig"};
this.cbo1.Items.Add(arr);

but this puts "String[] Array" in the combo box.

I would like to create some way to call a method that will add the array to
any or all of the combo boxex.

For example if i click on button 'btnCbo1' the combo box cbo1 will have the
items in the choices, or btnCbo2 will make those choices available to cbo2
etc.

Any help appreciated.

Doug
Jun 13 '07 #1
2 1756
hey i worked this out myself - dont know if it is the best way but this
work:

string[] arr = {"cat","dog","pig"};
this.cbo1.Items.AddRange(arr);

"Doug" <go**********@optusnet.com.auwrote in message
news:46***********************@news.optusnet.com.a u...
Hi

I have a list of about 50 text items (strings) that I would like to add to
about 5 combo boxes at various times depending on if a user clicks on the
OK button.

I have tried to code an example such as:
String ArrayList arr = new arr {"cat","dog","pig"};
this.cbo1.Items.Add(arr); but this doesn't work for me.

and i have tried:

string[] arr = {"cat","dog","pig"};
this.cbo1.Items.Add(arr);

but this puts "String[] Array" in the combo box.

I would like to create some way to call a method that will add the array
to any or all of the combo boxex.

For example if i click on button 'btnCbo1' the combo box cbo1 will have
the items in the choices, or btnCbo2 will make those choices available to
cbo2 etc.

Any help appreciated.

Doug


Jun 13 '07 #2
On Jun 13, 2:33 pm, "Doug" <gordononl...@optusnet.com.auwrote:
hey i worked this out myself - dont know if it is the best way but this
work:

string[] arr = {"cat","dog","pig"};

this.cbo1.Items.AddRange(arr);

"Doug" <gordononl...@optusnet.com.auwrote in message

news:46***********************@news.optusnet.com.a u...
Hi
I have a list of about 50 text items (strings) that I would like to add to
about 5 combo boxes at various times depending on if a user clicks on the
OK button.
I have tried to code an example such as:
String ArrayList arr = new arr {"cat","dog","pig"};
this.cbo1.Items.Add(arr); but this doesn't work for me.
and i have tried:
string[] arr = {"cat","dog","pig"};
this.cbo1.Items.Add(arr);
but this puts "String[] Array" in the combo box.
I would like to create some way to call a method that will add the array
to any or all of the combo boxex.
For example if i click on button 'btnCbo1' the combo box cbo1 will have
the items in the choices, or btnCbo2 will make those choices available to
cbo2 etc.
Any help appreciated.
Doug
Hi Doug,

It is the best way to add range of elements to a combo box.

Keep up the good work.

Moty

Jun 13 '07 #3

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

Similar topics

0
by: Jim | last post by:
Hi, there, I am a beginner on Access. I have been taking so long time to try to figure out his, but so far, no clues. I want to select 2 combo boxes and Access will automatically fill in...
4
by: Sherwood Botsford | last post by:
Table Markers ID (Primary Key) This&That PointClass (Combo box) Points Table PointClasses PointClass (primary key) Points (number) Description (Text)
1
by: arthur-e | last post by:
How can you select records based on more than one combo box - I have a combobox that selects records based on name (I'm sure this has been asked a thousand times - web site answer/link could be...
2
by: Joanne Lewis | last post by:
I am having a great deal of difficulty with a form. Basically, I would like to enter an account # and have the account #, patient first name, and patient last name automatically fill. The form...
1
by: Tom G | last post by:
Hello, I need some advice on which way to resolve the following. On a form, the user will make a selection from a combo box, after the selection several different fields need to be updated on...
18
by: Vayse | last post by:
Has anyone an example of filling a combo box with a data reader? Thanks Vayse
0
by: CanFlightSim | last post by:
I use combo boxes and a great little piece of code to fill a form with a record set. For example I want to search by Lastname and fill the form or by company and fill the form, I will start typing...
6
by: Dave | last post by:
I want to put the information that the user selects in my combo boxes into a subform that lies on the same form as the combo boxes. Thanks for your help already, Dave
2
by: peterjm | last post by:
I have three combo boxes, I want to populate them with different data from the same control source from a many to many relationship. example customer has many sales people assigned to them and many...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.