TreeView.BeginUpdate causing what seems like the thread to lock
-
When updating a TreeView, I call BeginUpdate() before adding any nodes. Every now and again, when this is done the thread seems to halt and does not get past the BeginUpdate() call. The problem is that this happens intermittently, thus sometimes I can spend 30mins trying to reproduce the problem, and it never happens, but other times it happens first attempt. Has anyone seen this happen? or knows of a problem with BeginUpdate?
Regards, Gareth. (FKA gareth111)
-
When updating a TreeView, I call BeginUpdate() before adding any nodes. Every now and again, when this is done the thread seems to halt and does not get past the BeginUpdate() call. The problem is that this happens intermittently, thus sometimes I can spend 30mins trying to reproduce the problem, and it never happens, but other times it happens first attempt. Has anyone seen this happen? or knows of a problem with BeginUpdate?
Regards, Gareth. (FKA gareth111)
Gareth H wrote:
Has anyone seen this happen? or knows of a problem with BeginUpdate?
Any chance of BeginUpdate being called on a different thread?
Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
Gareth H wrote:
Has anyone seen this happen? or knows of a problem with BeginUpdate?
Any chance of BeginUpdate being called on a different thread?
Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
No, since i do a
If (InvokeRequired)
at the top of the method.Regards, Gareth. (FKA gareth111)
Hmm. There's one problem I've seen with InvokeRequired - it returns false if the control's underlying Win32 handle hasn't been created. And that happens if the control hasn't become visible yet.
Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
Hmm. There's one problem I've seen with InvokeRequired - it returns false if the control's underlying Win32 handle hasn't been created. And that happens if the control hasn't become visible yet.
Regards Senthil [MVP - Visual C#] _____________________________ My Home Page |My Blog | My Articles | My Flickr | WinMacro
-
When updating a TreeView, I call BeginUpdate() before adding any nodes. Every now and again, when this is done the thread seems to halt and does not get past the BeginUpdate() call. The problem is that this happens intermittently, thus sometimes I can spend 30mins trying to reproduce the problem, and it never happens, but other times it happens first attempt. Has anyone seen this happen? or knows of a problem with BeginUpdate?
Regards, Gareth. (FKA gareth111)
Hi Gareth, I know your post is 3 month ago ... but I have the same problem seen right now. I can fill the tree a hundred time with no problem and then it happens after the third call. I didn't found a way to unlock the control - did you ? Until a better idea is supplied I don't use BeginUpdate() Regards, Frank
-
Hi Gareth, I know your post is 3 month ago ... but I have the same problem seen right now. I can fill the tree a hundred time with no problem and then it happens after the third call. I didn't found a way to unlock the control - did you ? Until a better idea is supplied I don't use BeginUpdate() Regards, Frank
Frank, The problem with my code was that i was doing an:
If (InvokeRequired)
On the main control class, which always returned false when the problem occurred, but the actaul TreeView control was returned true for InvokeRequired. Thus, the solution was to invoke on the TreeView control. If you need some more info, just say.
Regards, Gareth. (FKA gareth111)
-
Frank, The problem with my code was that i was doing an:
If (InvokeRequired)
On the main control class, which always returned false when the problem occurred, but the actaul TreeView control was returned true for InvokeRequired. Thus, the solution was to invoke on the TreeView control. If you need some more info, just say.
Regards, Gareth. (FKA gareth111)
Gareth, thank you for your answer, I see your problem was different, but I have the problem of a treeview lock when using BeginUpdate / EndUpdate. My program worked 4 years without error under .NET 1.1 and I got the problems changing to .NET 2.0 SP1 - why ever. I have nothing running in parallel tasks or threads which could interfere my program. I left BeginUpdate / EndUpdate unused - no problem any more. But that leaves no good feeling. Regards, Frank