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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top