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.