what's wrong?

  • Thread starter Thread starter Hrvoje Voda
  • Start date Start date
H

Hrvoje Voda

I would like to fill combo box with a string.

I call this function but nothing is placed in it.

string UserName = "something";

comboBoxMembers.Items.Add(UserName);
 
Hi,

Do you mean "to appear as selected"? Otherwise is correct, to show the entry
as the first one try this.

Combo.Items.Add("First Entry");
Combo.SelectedIndex = 0;

Cheers
Salva
 
I would like to fill combo box with a string.

I call this function but nothing is placed in it.

string UserName = "something";

comboBoxMembers.Items.Add(UserName);

What do you mean by "fill combo box with a string"? Do you want to add
entries to the DropDownList or do you want to set the Text that is
displayed in the TextBox part of the ComboBox?

To fill the DropDownList, your code looks correct.

To fill the TextBox: comboBoxMembers.Text = UserName;
 
Back
Top