I have a problem filling my ComboxBox
. Here´s my code:
string[] test = { "Ausgaben", "Eingaben" };
foreach (string r in test)
{
cbEinAus.Items.Add(r);
}
The values from the string array are in the ComboBox
, but the selected item is a empty string.
I want one of this two string from the array to be my selected item.
I already tried with the SelectedItem
property, but that doesn´t work.
Maybe its a simple solution... Can anybody help me please?
Use:
cbEinAus.SelectedIndex = 0;
You can replace the 0
with the zero based index of whichever item you want to select.