Click here to Skip to main content
15,920,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have problem to enable and disable control while making selection in combobox.
Posted
Updated 29-Apr-11 4:24am
v2
Comments
Sandeep Mewara 29-Apr-11 8:18am    
Not clear. What do you mean by 'enable' or disable control here?

Edit and rephrase it.

use combobox selectedindexchanged event as set AutoPostback=true
on basis of recieved selected index
u can enable or disable textboxes like

if(combo1.selecteditem.text=="a")
txtbox1.enabled=true;
else
txtbox1.enabled=false;
 
Share this answer
 
Use the SelectedIndexChanged event of the combo box. In that method, you can use

TextBox.Enable = true; // to enable it

TextBox.Enable = false;  // to disable it
 
Share this answer
 
If you mean to disable textboxes while selection process is active you should check out:
C#
private void comboBox1_DropDown(object sender, EventArgs e)
{
    //Do your stuff
}
private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
    //Undo your stuff
}
 
Share this answer
 

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