-
totally lost
This question isn't getting any response in the main forum. Perhaps someone here can help out:
Here's my problem. I have a class mod that does two things. First it performs a bit of (heavy duty) math. Second, it draws graphical information on a picturebox (via the .circle and .line methods.) Becuase the users need to see the graphs as they are being drawn, each drawing takes about 20 seconds to complete (this is not a speed issue, the drawings are slow on purpose!)
The problem is this. I need to have 3 (perhaps more) instances of my class drawing on the picturebox at the same time, each drawing something different based on the values passed to the draw method in the class. However, if I create an array of the classes and loop through them calling the draw method of each class only one graph draws at a time. I need each of the images to be drawn simultaneously. In other words, I need a way to implement asynchronous processing, but without using out of process components. What can I do?
Before you answer, here's one last thought. Right now I have an array of classes so I can loop through them, but when you create an array of classes you can't use the WithEvents statement so your program responds to their events. Is there a good way around this problem?
Please and thank you for your help, I'm stuck without it!!!
-
Classes which are in a collection can be Dim WithEvents.
You can use a collection and loop thru it.
-
can you give me an example of how the collection item would respond to an event raised by the class?
Thanks for your help and the great idea!
-
Never mind...I got the events working, but the whole thing still doesn't work asynchronously. Even if I loop through the collection the entire bit of code in the instance of the class runs before the next one starts. :(
-
The only way I know of to do asynch processing is in ActiveX Exes and that runs out of process, which you said you didn't want.
-
Asynchronous is synonymous with multi-threading a particular issue that VB is not very good at.
You will need to put your code in an Active EXE if you want asynchronous processing, or code it in C++
Sorry