Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi! i have problem in the combo box ..when i select the value in the combo box the value in the combo box remain unchanged even i used the function combo box1.refresh(); but it did not refresh..how can i set it again ??here i explain ...for example i have values in the combo box like male and female ..and at the form load the text that is pre written in the combo box is select gender and the values are male and female ...when the customer select the value male and when the form values submit after click on refresh button the vallue in the combo box must be refresh and again in the combo box there should be select gender text.....after refreshing thanx if u help
Posted
Comments
Uday P.Singh 10-Jun-11 13:23pm    
can you post your code??

This[^] may help.
 
Share this answer
 
this may help you.....
Write this code at last in button click
comboBox1.Items.Clear();
comboBox1.Items.Add("---select---");
comboBox1.Items.Add("Male");
comboBox1.Items.Add("Female");
 
Share this answer
 
Comments
sunnyaliraza 11-Jun-11 12:16pm    
i m thank ful to you for ur solution it was pretty well.....but only thing that i want was that the text should be visible like select gender but when it become item its hide in the combo box...but this solution give me the idea and i use a a little bit change and find the exact solution any way thanks plz i need ur help further for 3 months that was the code
comboBox2.Text = string.Empty;
comboBox2.Items.Clear();
comboBox2.Text = "select gender";
comboBox2.Items.Add("male");
comboBox2.Items.Add("female");
parmar_punit 13-Jun-11 0:09am    
Thanks dear, dont forget to upvote it, if you fill it usefull :)
You can use

combobox1.text=string.Empty;


to clear the combobox.

hope this help :)

for further queries comment here!!
 
Share this answer
 
Comments
sunnyaliraza 10-Jun-11 15:56pm    
yup its working well it delete the text in the combo box but i want that the prewitten text should be remain there like select gender should be remain there and the value like male or female disappear and pre written text should be remain there thanx if u try to help me again .....

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