Hi I have a combo box and im trying to make the index a default string.
so for example
i want the box to formatted in this order.
Choose fruit
--------------- so I want this line to be blank at all times
apple
orange
grapes
pear
after I choose and item , revert back to reset the index back to the default string, but remember i want the second line to be blank
Loading
VasanthPosted Mar 25, 2010, 5:59 AM
private void Form1_Load(object sender, EventArgs e)
{
comboBox1.Items.Insert(0, "Choose Fruits");
comboBox1.Items.Insert(1, "");
comboBox1.Items.Insert(2, "apple");
comboBox1.Items.Insert(3, "orange");
comboBox1.Items.Insert(4, "grapes");
comboBox1.Items.Insert(4, "pear");
comboBox1.SelectedIndex = 0;
}
private void btnReset_Click(object sender, EventArgs e)
{
comboBox1.SelectedIndex = 0;
}
Please mark as answer if its helps you.