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("/");

widy guiPosted May 5, 2014, 5:21 AM
VulpesPosted May 4, 2014, 5:50 PM
cmbbxOperator.SelectedIndex = 0;
widy guiPosted May 4, 2014, 11:02 AM
First of all,thanks for the response.
Is the code to make "-select-" appear in the combobox right after I run it??
Lakshmanan Sethu SankaranarayanPosted May 4, 2014, 9:46 AM
Welcome Widy.
Please try this
cmbbxOperator.Items.Insert(0, new ComboBoxItem("-Select-", string.Empty));