I have a List object which will get updated from a service application. I want to bind and update the data grid view with this List object asynchronously in a background thread without affecting the UI.
Any help will be appreciated

Thanks
Anilal Sambasivan
Anilal SambasivanPosted Mar 11, 2011, 2:23 AM
Initialize thread and delegate delegate
void Bind_DataTable_to_GridView_Delegate(DataTable dt);
Thread tBindGrid;
2: {3: InitializeComponent();4:7: dtCustomers.Columns.Clear();12: dataGridView1.DataSource = dtCustomers;15:16: tBindGrid.SetApartmentState(ApartmentState.STA);18: tBindGrid.Start();19: }20:23: {25: dt.Columns.Clear();26:30:32: IService service = factory.CreateChannel();33:34: System.ServiceModel.Channels.Message message = service.GetCustomers();35:37: {39: {40: DataRow dr = dt.NewRow();44:45: dt.Rows.Add(dr);46: }47: bind_DataTable_to_GridView(dt);48: dt.Clear();49: }50: }51:54: {55:57: {60: }62: {63: dtCustomers.Merge(dt);66: {67: dgvcol.SortMode = DataGridViewColumnSortMode.NotSortable;68: }69: }70: }Thanks for your support
Anilal Sambasivan
http://anilalsambasivan.blogspot.com/
Suthish NairPosted Mar 10, 2011, 1:18 PM
Amit ChoudharyPosted Mar 9, 2011, 4:23 AM
Use a background worker thread to execute work in the background.
Here is example how to do it:
Anilal SambasivanPosted Mar 9, 2011, 3:42 AM
Krishna GaradPosted Mar 9, 2011, 2:56 AM