J
Julie J.
When working w/ forms and controls, in 95% of the cases, the value of the
control is used somewhere in the program (duh!).
However, there doesn't seem to be an easy way to attach a value variable to
that control the automatically handles synchronization of the value w/ the
contol.
Here is an example:
// some form
System.Windows.Forms.TextBox inputSearchString;
// some variable that holds the value of the input
string searchString;
Now, if I want to synchronize the value of the input w/ the string, I have to
go and create a couple of event handlers that copy the text box value to the
string if I want to ensure that the searchString is always current.
It seems that a better solution would be for something like an attach operation
that would couple and synchronize the values:
searchString.AttachTo(inputSearchString);
Now, whenever the value of inputSearchString changed, it would automatically
update the value in searchString.
Is there something in the language/framework that I've missed that would allow
this type of functionality, or must I just create a mess of event handlers?
control is used somewhere in the program (duh!).
However, there doesn't seem to be an easy way to attach a value variable to
that control the automatically handles synchronization of the value w/ the
contol.
Here is an example:
// some form
System.Windows.Forms.TextBox inputSearchString;
// some variable that holds the value of the input
string searchString;
Now, if I want to synchronize the value of the input w/ the string, I have to
go and create a couple of event handlers that copy the text box value to the
string if I want to ensure that the searchString is always current.
It seems that a better solution would be for something like an attach operation
that would couple and synchronize the values:
searchString.AttachTo(inputSearchString);
Now, whenever the value of inputSearchString changed, it would automatically
update the value in searchString.
Is there something in the language/framework that I've missed that would allow
this type of functionality, or must I just create a mess of event handlers?