Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am making desktop application using C#.NET and SQL SERVER.
how to reset the comboboxes which are having style DropDownList

how to reset the comboboxes which are having style dropdownlist
I have tried coding but no affect
private void btnreset_Click(object sender, EventArgs e)
{
  cbopropectid.Text = "";
  cbocustomername.Text = "";
  cboproducts.Text = "";
}

Pls help
Posted
Updated 10-May-11 3:29am
v2

1 solution

Do yourself a favor, never write "" in code, use system.Empty.
You cannot "reset" a combo box — what is it? myComboBox.SelectedIndex = -1. You can have a special (first) item like "[select a value]" which will denote "unselected" option. For "resetting" use myComboBox.SelectedIndex = 0.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900