Results 1 to 6 of 6

Thread: totally lost

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265

    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!!!

  2. #2
    jim mcnamara
    Guest
    Classes which are in a collection can be Dim WithEvents.

    You can use a collection and loop thru it.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265
    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!

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2000
    Location
    Denver
    Posts
    265
    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.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    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.

  6. #6
    Frenzied Member yrwyddfa's Avatar
    Join Date
    Aug 2001
    Location
    England
    Posts
    1,253
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width