Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Q. How do you start 2 or more other classes to threading from a single Form1??

Posted on 2004-08-26
2
Medium Priority
?
241 Views
Last Modified: 2010-04-15
Q. How do you start 2 or more other classes to threading from a single Form1??

I tried this code on Form1 (Form1_Load) but if failed...

objClass1 = new Class1();
objClass1 = new Thread(new ThreadStart(StartMoveKing));
      
 // also

objClass2 = new Class2();
objClass2 = Thread(new ThreadStart(StartMoveQueen));
0
Comment
Question by:kvnsdr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 3

Expert Comment

by:gillgates
ID: 11908434
using System.Threading;

Class1 objClass1;
Thread t;

objClass1 = new Class1();
t = new Thread(new ThreadStart(objClass1.YourFunc));
t.Start();
0
 
LVL 3

Accepted Solution

by:
gillgates earned 1000 total points
ID: 11908445
using System.Threading;

Class1 objClass1;
Class2 objClass2;
Thread t1;
Thread t2;

objClass1 = new Class1();
t1 = new Thread(new ThreadStart(objClass1.StartMoveKing));
t1.Start();

objClass2 = new Class2();
t2 = Thread(new ThreadStart(StartMoveQueen));
t2.Start();
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Loops Section Overview
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question