I am working on a windows application in which i had created two new threads, one is for progress bar and another is for extracting data from db. What i want is when the second thread is completed, it will terminate the first thread and autoredirect the page to another page. I am able to redirect to another page but as the threads are running it returns back to first page.
Here is my code:
private void LoadingForm_Load(object sender, EventArgs e)
Thread thread = new Thread(new ThreadStart(loadbar));
CheckForIllegalCrossThreadCalls = false;
Thread Customerthread = new Thread(new ThreadStart(GetCustomerDetails));
private void loadbar()
progressBar1.Minimum = 1;
progressBar1.Maximum = 25;
progressBar1.Value = 1;
progressBar1.Step = 1;
for (int i = 0; i < 25; i++)
CustomerList cList = new CustomerList(ListValues);
private void GetCustomerDetails()
// Code to get data from db.
Here the control goes to customerlist page but returns back after running its constructor.