/// <summary> /// Thread safe grid binding. /// </summary> /// <param name="dataSource">Data source</param> /// <param name="dataMember">Data member</param> private void SetGridDataSource(object dataSource, string dataMember) { // InvokeRequired required compares the thread ID of the // calling thread to the thread ID of the creating thread. // If these threads are different, it returns true. if (this.grdComponents.InvokeRequired) { SetGridDataSourceCallback callBack = new SetGridDataSourceCallback(SetGridDataSource); this.grdComponents.Invoke(callBack, new object[] { dataSource, dataMember }); } else { this.grdComponents.DataSource = dataSource; this.grdComponents.DataMember = dataMember; } }