M
moondaddy
I'm reading the book Wrox-Professional C# 2005 and it's trying to
demonstrate an anonymous method in an event handler. I would not do this in
a real app, but am trying to understand how this works.
They have a windows form with a button on it. Rather than wiring up the
click event to a method, they just wire it up to some code like this:
btnOne.Click += new EventHandler(lblInfo.Text = "Show some text."
;
Doesn't look like a good idea, but never the less, I'm trying to see it
work. this line is exactly as they have in the book and it get the
following compile errors:
Error 1 ) expected
Error 2 Invalid expression term ')'
Am I missing something or is the author out of his mind?
Thanks.
demonstrate an anonymous method in an event handler. I would not do this in
a real app, but am trying to understand how this works.
They have a windows form with a button on it. Rather than wiring up the
click event to a method, they just wire it up to some code like this:
btnOne.Click += new EventHandler(lblInfo.Text = "Show some text."

Doesn't look like a good idea, but never the less, I'm trying to see it
work. this line is exactly as they have in the book and it get the
following compile errors:
Error 1 ) expected
Error 2 Invalid expression term ')'
Am I missing something or is the author out of his mind?
Thanks.