Control.BeginInvoke()
-
I use the following code to operate my treeview asynchronously. IAsyncResult result = sourceTree.BeginInvoke(l_CreateTreeNodes, new object[] { sourcenode.Nodes[stables],destinationnode.Nodes[dtables],mSourceInfo.TableNames,mDestinationInfo.TableNames}); While(!result.IsCompleted){} But asynchronous operation is not completed and 'result.IsCompleted" property is always 'false'. So, the operation isn't existed from while loop. I don't know why 'IsCompleted' property is always false. :confused:
-
I use the following code to operate my treeview asynchronously. IAsyncResult result = sourceTree.BeginInvoke(l_CreateTreeNodes, new object[] { sourcenode.Nodes[stables],destinationnode.Nodes[dtables],mSourceInfo.TableNames,mDestinationInfo.TableNames}); While(!result.IsCompleted){} But asynchronous operation is not completed and 'result.IsCompleted" property is always 'false'. So, the operation isn't existed from while loop. I don't know why 'IsCompleted' property is always false. :confused:
If you need blocking calls, why to use
BeginInvoke
? UseInvoke
instead. It is synchronous and waits until the message is processed.Navaneeth How to use google | Ask smart questions
-
I use the following code to operate my treeview asynchronously. IAsyncResult result = sourceTree.BeginInvoke(l_CreateTreeNodes, new object[] { sourcenode.Nodes[stables],destinationnode.Nodes[dtables],mSourceInfo.TableNames,mDestinationInfo.TableNames}); While(!result.IsCompleted){} But asynchronous operation is not completed and 'result.IsCompleted" property is always 'false'. So, the operation isn't existed from while loop. I don't know why 'IsCompleted' property is always false. :confused:
Not that it matters, but why
{}
rather than;
?