C# System.InvalidCastException

后端 未结 2 1267
走了就别回头了
走了就别回头了 2020-12-10 22:09

Why I\'m getting this error?

\"enter

System.InvalidCastException was u         


        
2条回答
  •  抹茶落季
    2020-12-10 22:46

    The following solves your cross thread issue.

    public delegate string GetStringHandler();
    public string GetDocumentText()
    {
        if (InvokeRequired)
            return Invoke(new GetStringHandler(GetDocumentText)) as string;
        else
            return webBrowser.DocumentText;
    }
    
    if (regAddId.IsMatch(GetDocumentText()))
    {
    }
    

提交回复
热议问题