Showing posts with label C# Delegates. Show all posts
Showing posts with label C# Delegates. Show all posts

Friday, July 27, 2012

Exception from HRESULT: Excel automation issues

I was getting bizarre Exception from HRESULT: on vista where it worked fine on xp
I tried setting security to allow vba projects - nyet
I tried dcom - it wasnt there
I finally tried savecopyas   lo  and behold - it worked

Friday, March 2, 2012

Anonymous Delegates

I thought a good place for Anonymous Delegates would be in dynamically created menu items that all do the same thing. This is also a good place for lambda expressions.


an interesting point


lets say I am adding a click event handler to a menu item
this is legal

ti2.Click +=  delegate { this.textBox1.Text = nav.Value; };
even though there are no arguments

this is not:
ti2.Click += () => { this.textBox1.Text = nav.Value; };

you need the input parameters

ti2.Click +=  (o,a  )=>{ this.textBox1.Text = nav.Value; };