Combo Box Value Changed

J

Jeff Williams

I have a combobox (has a text display string and value) and two Text
boxes on a form.

Depending on the SelectedValue of the combobox I want to make one or
both of the textboxes readonly.

How can I achieve this.

Regards
Jeff
 
A

AliRezaGoogle

I have a combobox (has a text display string and value) and two Text
boxes on a form.

Depending on the SelectedValue of the combobox I want to make one or
both of the textboxes readonly.

How can I achieve this.

Regards
Jeff

Hi Jeff
you can do this very easyly by adding a SelectedValueChanged event
handler to your combobox like this:

private mycombobox_SelectedValueChanged ( sender e , EventArgs)
{
if ( mycombobox.SelectedValue.ToString() == "Hello")
textbox1.ReadOnly = true;


}

That's All;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top