How do I pass 1 argument in lambda expression?
Maybe I need to put Action<string> somewhere?
6 Replies
Task.Run doesn't accept an Action<T>
But you are able to use tempTitle inside of the function
Anonymous functions are able to use variables previously declared in scope but be careful about it
Is that what you meant? Then I have unhandled exception
Is
Text
a variable you already declared?No, this is a property of a form, Windows Forms framework
So what does the error say?
As on the previous screenshot, Exception Unhandled Cross-thread operation not valid
But you gave me something to wonder, it's not an issue with my string but accessing this "Text" property, I need to check if an invoke is required, hold on please
Yeah, that was my mistake and not issue with my string but accessing that "Text" property. Thanks @daVinki a lot! The above script works now and my program runs without cross-thread exception