In my C# winforms application I am loading the data from the database using Task in the background, below is my code. But after uploading the data I am updating my UI control(s) which is BindingSource. This BindingSource component is connected to the DataGrid which will be updated as well.
what I need to know is that what I am doing is the right way or is there another better way to achieve the same goal.
private async void Form_Load(object sender, EventArgs e)
{
Task loadDataTask = Task.Factory.StartNew(() =>
{
// LoadData(); // loading the data from the database
});
await loadDataTask.ConfigureAwait(true);
FormBindingSource.DataSource = _businessObjecsCollection;
}