Link to home
Start Free TrialLog in
Avatar of felkamau
felkamau

asked on

Adding static values to drop down list

I need to add several static values to a drop down list in c#. e.g. 01, -12. I know I can achieve this through a "for loop", but I would like to use the actual values (maybe through some array of sorts?)
Avatar of CBeach1980
CBeach1980

Create an ArrayList to store the values:
ArrayList values = new ArrayList();
values.add("val1");
values.add("val2");
values.add("val3");
etc...

for (int i=0; i < values.Count; i++)
   dropDownList.Items.Add(values[i].ToString());
ASKER CERTIFIED SOLUTION
Avatar of CBeach1980
CBeach1980

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial