Click here to Skip to main content
15,888,202 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hello, I`m making a windows application

When I click the Button then data is loading in Datagridview,

In this step I want to show the progress using Progress bar or spinner.

But for me, this is the first time to use that, I don`t have no idea...

I just searched it and use backgroundworker or thread...

Please somebody help me.

My button click event is below. how can I add or modify code?

What I have tried:

C#
private void btnStart_Click(object sender, EventArgs e)
{
    string webApplicationName = string.Empty;
    string siteID = string.Empty;
    mtlblError.Text = "no record returned";

    Migration_Status_DAC dac = new Migration_Status_DAC();
    DataSet ds = new DataSet();

    try
    {

        ds = dac.SelectWebApplicationStatus(mtextUrl.Text);
        DataTable dt = ds.Tables[0];


        if (ds != null && dt != null && dt.Rows.Count > 0)
        {
            webApplicationName = dt.Rows[0]["AppName"].ToString();
            mgrdWebApplication.DataSource = dt;
        }
        else
        {
             mtlblError.Visible = true;
        }
    }
    catch(Exception ex)
    {
        LogWrite.writeLog(ex.ToString();
    }
}
Posted
Updated 10-Oct-16 18:46pm

1 solution

 
Share this answer
 
Comments
RydenChoi 11-Oct-16 1:04am    
Oh thanks Tadit Dash. but in my code, I connected with 5 datatables.
My source in above, it`s a part of one...
So can you explain how can I set 5 DataTable??
You can do all task in one method and call that in a thread.

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