Reputation: 131
So I have this line of code:
Invoke(Sub()pt = PictureBox1.PointToScreen(bounds.Location))
I was able to use it on VS2013 without error but when I transferred to VS2008 there was an error saying "Expression Expected". Is there a way to use this code in VS2008? because I don't know how to use delegates.
Upvotes: 1
Views: 232
Reputation: 942256
Using Sub
in a lambda expression was not possible until VS2010. The logical alternative is:
Dim pt As Point = DirectCast(Me.Invoke(Function() PictureBox1.PointToScreen(Bounds.Location)), Point)
Which is in fact superior to the original since it doesn't have to capture any variables.
Upvotes: 2