Hi, confused1982,
Based on my understanding, when you invoke a method of your TreeView without the paramter part, you will get a NullPointerException, right?
Well,I am afraid that this is not a bug/issue with TreeView.
Because your InternalLoadHandlerContentsUI method has an object parameter, so you will need to pass a parameter to the delegate.
Please read this article
http://msdn2.microsoft.com/en-us/library/a1hetckb(VS.80).aspx
"method
A delegate to a method that takes parameters of the same number and type that are contained in the args parameter. "
As you are using aWaitCallBack to create the delegate, if you remove the new object(), it will lose the parameter and give you a NullPointerException.
Maybe this sample will give you a more clear concept.
Code Block
object nullObject = null;
private void MyMethod()
{
if (treeView1.InvokeRequired)
{
treeView1.Invoke(new WaitCallback(LoadHander), nullObject);
}
//......
}
Hi, confused1982,
Based on my understanding, when you invoke a method of your TreeView without the paramter part, you will get a NullPointerException, right?
Well,I am afraid that this is not a bug/issue with TreeView.
Because your InternalLoadHandlerContentsUI method has an object parameter, so you will need to pass a parameter to the delegate.
Please read this article
http://msdn2.microsoft.com/en-us/library/a1hetckb(VS.80).aspx
"method
A delegate to a method that takes parameters of the same number and type that are contained in the args parameter. "
As you are using aWaitCallBack to create the delegate, if you remove the new object(), it will lose the parameter and give you a NullPointerException.
Maybe this sample will give you a more clear concept.
Code Block
object nullObject = null;
private void MyMethod()
{
if (treeView1.InvokeRequired)
{
treeView1.Invoke(new WaitCallback(LoadHander), nullObject);
}
//......
}
You can use google to search for other answers