Results 1 to 5 of 5

Thread: [2.0] Why can't I perdorm an asynchronous tasks?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    Question [2.0] Why can't I perdorm an asynchronous tasks?

    Hello you guys!!

    I have a class, with a list in it, and a method to papulate that list.
    I want to perform the population of the list in another thread.
    to do this, I use this code:
    Code:
    MyClass NewClass = new MyClass();
                System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(NewClass.populateList));
                t.Start();
    But after this, the list is still empty...
    what am I doing wrong?

    thanks!!

    Dekel C.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Why can't I perdorm an asynchronous tasks?

    There's no possible way to know without seeing the code for the PopulateList method. Are you sure that you are populating the same object in the worker thread that you're later testing in the UI thread?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    Re: [2.0] Why can't I perdorm an asynchronous tasks?

    When I was not using the second thread, the code worked fine, and the list
    was populated...
    Dekel C.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] Why can't I perdorm an asynchronous tasks?

    We are not telepathic. Your app does what the code tells it to do. Without the code we cannot possibly know what the issue is.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Location
    I'm right here!
    Posts
    849

    Re: [2.0] Why can't I perdorm an asynchronous tasks?

    OK, I just wanted to know if I am using the second thread like I should...

    The code to populate the list works, but the code to start the second thread
    gives me nothing... it doesn't even step into the populateList method...
    Dekel C.

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