J. Scott Elblein
Well-known member
I am learning my way around the BGW now, and and getting an "InvalidCastException was unhandled by user code" error on this line of code when being sent through the BGW thread ("Specified cast is not valid."):
I'm thinking it has to do with the fact that I have "wbr as webbrowser" as a parameter in the call to the Sub, and it's outside of the BGW thread now? If so, how would I go about fixing this?
Also, I would love some information on changing things IN a Sub in a BGW thread. I have read so far that all things having to do w/the UI must be done with bgw_runworkercompleted, but a couple things I'm trying to change at the time of it running are in areas that I can't really wait until it's completed to do, (some label changes and a progressbar)
TIA
VB.NET:
strTotalPages = wbr.DocumentText.Substring(wbr.DocumentText.IndexOf("pagingOf"))
I'm thinking it has to do with the fact that I have "wbr as webbrowser" as a parameter in the call to the Sub, and it's outside of the BGW thread now? If so, how would I go about fixing this?
Also, I would love some information on changing things IN a Sub in a BGW thread. I have read so far that all things having to do w/the UI must be done with bgw_runworkercompleted, but a couple things I'm trying to change at the time of it running are in areas that I can't really wait until it's completed to do, (some label changes and a progressbar)
TIA