Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

winforms C# code cross thread operation is not valid

UserContrl1_LOadDataMethod()
{
    string name = "";
    if(textbox1.InvokeRequired)
    {
        textbox1.Invoke(new MethodInvoker(delegate {
          name = textbox1.text; 
        }));
    }
    if(name == "MyName")
    {
        // do whatever
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #winforms #code #cross #thread #operation #valid
ADD COMMENT
Topic
Name
8+7 =