Click here to Skip to main content
15,036,654 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys.

I have a question and that is as below.

I Have tow Methods Say "BindCSVData()" and "BindTreeViewData()"

1st I want to call "BindCSVData()" after some time of execution of that I want to start execute "BindTreeViewData()". So how can I do that ?

My Code is as below.
Thread thStart = new Thread(BindCSVData);
thStart.IsBackground = true;
thStart.Start();

Thread thStart1 = new Thread(BindTreeViewData);
thStart1.Start();

My scenario is that First BindCSVData get Call after a specific time Interval BindTreeViewData will get call and then both get execute simultaneously.

Is anything to change in My code ?
Please help me Out.

Thanks,
Rajan
Posted

use a Timer and in its tick event or elapsed event, start the second thread.
   
v2
Add this line over there ....
C#
while (!thStart.IsAlive) ;

This will make sure that your first thread is started working...
C#
  Thread thStart = new Thread(BindCSVData);
  thStart.IsBackground = true;
  thStart.Start();
  while (!thStart.IsAlive) ;
  Thread thStart1 = new Thread(BindTreeViewData);
  thStart1.Start();
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900