Using await with a TableAdapter...datagrid is only displaying one record

sarah good

New member
Joined
Jan 11, 2017
Messages
1
Programming Experience
1-3
I am trying to run the fill for datagridview on a worker thread so I can have the UI still responsive while my datagridview loads the data. Problem is when I execute the code below, the datagridview only loads one record.

 
private void timer1_Tick(object sender, EventArgs e)

        {


 

            timer1.Enabled = 
false;

            FillAsync();


           
//once datagridview is loaded lbDatabaseLoading will hide along with the progressbar.

            lbDatabaseLoading.Hide();

            progressBar1.Hide();


        }


        
public Task FillAsync()

        {

            
return Task.Factory.StartNew(() =>

            {

                
// TODO: This line of code loads data into the 'db_reconDataSet.recon' table. You can move, or remove it, as needed.

                
this.reconTableAdapter.Fill(this.db_reconDataSet.recon);

                
// etc

            });

        }


        
public async Task RebindUI()

        {

            

            
// Fill datasets on background thread

            
await FillAsync();


           

            

           

        }


        }


 

Latest posts

Back
Top Bottom