zoukankan      html  css  js  c++  java
  • **********method.Invoke Exception has been thrown by the target

    You may receive this exception when you use the Invoke() method (of a form perhaps). The cause of this exception is another exception which occured inside the
    from:
    http://www.geekpedia.com/KB70_Exception-has-been-thrown-by-the-target-of-an-invocation.html

    method being invoked.
    Since you don't know what actually went wrong inside the method that was being invoked, we will need to get the inner exception of the method.
    Suppose we have the following line which invokes a method:

    MyForm.Invoke(MyForm.MyDelegate, new Object[] { someParameter });

    To catch the exception, enclose the line within a try/catch block and get the InnerException:

    try
    {
       MyForm.Invoke(MyForm.MyDelegate, new Object[] { someParameter });
    }
    catch (Exception ex)
    {
       MessageBox.Show(ex.InnerException.Message);
    }

    This should show you the actual exception message inside a message box.
  • 相关阅读:
    UVa 107 The Cat in the Hat
    UVa 591 Box of Bricks
    UVa 253 Cube painting
    UVa 10161 Ant on a Chessboard
    UVa 401 Palindromes
    UVa 465 Overflow
    我不知道
    消防局的设立
    某CF的D
    保安站岗
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2293301.html
Copyright © 2011-2022 走看看