Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind one control to another?

I have a checkbox with a Checked property and a Listbox with an Enabled property. I'd like to data bind the controls in such a manner that when the user checks the Checkbox, the listbox becomes enabled. Conversely, when the user unchecks the checkbox, the listbox becomes disabled.

How can I do something like that?

like image 842
AngryHacker Avatar asked Jan 22 '23 11:01

AngryHacker


1 Answers

Sorry, I should have done a bit of googling. The answer is actually pretty simple:

cbo.DataBindings.Add("Enabled", chk, "Checked");
like image 167
AngryHacker Avatar answered Feb 02 '23 00:02

AngryHacker