Combobox Help - newbie question

  • Thread starter Thread starter Ash
  • Start date Start date
A

Ash

Hi,

I've got an array with string elements in it, and i also have a combo box
with items statically added at design time into the list collection.

The array is going to have data such as
"Business","Hospital","Government","Unknown"

The Combo box has items with similar names. I want to be able to update the
combo box with the specific item that the array's index is on. Therefor, if
we are referring to array[1], then the combobox should show me the item
"Hospital" selected.

Any idea how to work on that?

Thank you!
Ash
 
Ash,

You should be able to data bind to the array itself, and use that. If
you bind the combobox to the array, then the combobox will show the values
in the array as it's list, and you can then use the index to access the item
in the array (or get the value straight from the combobox).

Hope this helps.
 
hi,

I have created a form, which shows data in the respective textbox from an
array of strings. one of the fields (lets call it category), is a combobox..
Whenever i click next button, the combobox should update showing the string,
which woudl be in the array, on the current index.

Would appreciate if someone there could help me out!

Here's the code example:

comboBox1.???? =CustomerList[ArrayIndex].categoryName;

textBox2.Text=CustomerList[ArrayIndex].fullName;

textBox3.Text=CustomerList[ArrayIndex].AddressName;

What do i replace the ??? with, so that i can select the right data from the
combobox?

Thanks,
Ash

Nicholas Paldino said:
Ash,

You should be able to data bind to the array itself, and use that. If
you bind the combobox to the array, then the combobox will show the values
in the array as it's list, and you can then use the index to access the item
in the array (or get the value straight from the combobox).

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Ash said:
Hi,

I've got an array with string elements in it, and i also have a combo box
with items statically added at design time into the list collection.

The array is going to have data such as
"Business","Hospital","Government","Unknown"

The Combo box has items with similar names. I want to be able to update the
combo box with the specific item that the array's index is on. Therefor, if
we are referring to array[1], then the combobox should show me the item
"Hospital" selected.

Any idea how to work on that?

Thank you!
Ash
 
Back
Top