HI Everyone,I'm new member here. First of all,I would like to introduce myself.
My name is Widy gui. widy is my first name and gui is the surename.
So I would like to ask how to set default in ComboBox??
I have added item in the ComboBox,but I would like to set a default in the combobox so after I run it,it will appear the first item which I added.
Here my code to add item in the ComboBox:
cmbbxOperator.Items.Add("+");
cmbbxOperator.Items.Add("-");
cmbbxOperator.Items.Add("X");
cmbbxOperator.Items.Add("/");


Lakshmanan Sethu SankaranarayanRank #124 · 17.7K reputationPosted May 4, 2014, 5:46 AM EDT
Welcome Widy.
Please try this
cmbbxOperator.Items.Insert(0, new ComboBoxItem("-Select-", string.Empty));
widy gui8 reputationPosted May 4, 2014, 7:02 AM EDT
First of all,thanks for the response.
Is the code to make "-select-" appear in the combobox right after I run it??
VulpesRank #55 · 29.2K reputationPosted May 4, 2014, 1:50 PM EDT
cmbbxOperator.SelectedIndex = 0;
widy gui8 reputationPosted May 5, 2014, 1:21 AM EDT