2 Attachment(s)
progress bar, multithreading
Hi
I'm trying to implement a progress bar so that when a user clicks to open a report, a small form with the progress bar embedded in the statusbar appears to show that something is happening.
I'm very new to VB.NET and multithreading is a bit above my level of understanding so any help would be greatly appreciated!
I've cobbled together some code using a Backgroundworker based on various examples that I've found but I don't really know if it's right.
Basically I have two problems:
1) The progress bar form appears before the report viewer form opens but is then hidden when the report viewer form opens until the report is fully loaded when it is then closed. The Topmost property on the form is set to True and I thought that this coupled with the Backgroundworker would mean that it would stay at the top. Is there something else I need to do?
2) The first time I run this, it appears to work ok (apart from not being at the front). If I then close the reportviewer form and click to open another report, I get a TargetInvocationException. I'm unsure which part of the code it relates to and am not sure how to deal with it or why it's happening.
I've attached the code so you can have a look. Thanks.
Re: progress bar, multithreading
Hi there, I don't know how to fix your problem, I recently started learning about multithreafding also, I have some video tutorials and a flash presentation which explain multithreading well in vb2005, the demo project that the guy goes through is similar to your question with a progress bar on a different thread. PM me if you need them
Re: progress bar, multithreading
OK, I've got a little further. I was making a call to close the Progress Bar form at the end of the onLoad of the reportviewer form so it was closing it when the form had loaded up but the report still hadn't appeared. I've taken that out so the progress bar shows on top of the reportviewer form but now I'm not sure when to close it down.
I'm not sure if I'm doing this right. I'm opening the progress bar form and the reportviewer form from the same place. Is that right or should I be doing something like calling the reportviewer form from the progress bar form?
Sorry, this is probably a very obvious question but I'm just not getting this multithreading business!