static void table_RowChanging(object sender, DataRowChangeEventArgs e) { Loading load = new Loading(); Trace.WriteLine(string.Format("DataTable_RowChanging(): Action {0}, RowState {1}", e.Action, e.Row.RowState)); if (e.Action == DataRowAction.Add) { e.Row.ClearErrors(); DataTable updateDataTable = load.RecalcData(sender as DataTable); } if (e.Action == DataRowAction.Change) { e.Row.ClearErrors(); DataTable updateDataTable = load.RecalcData(sender as DataTable); } }
private void btn_Refresh_Click(object sender, EventArgs e) { Loading load = new Loading(); var foo = (BindingSource)dataGridView1.DataSource; var test = (DataSet1)foo.DataSource; DataTable test2 = load.RecalcData(test.Tables[1]); foo.DataSource = test2; dataGridView1.DataSource = foo; dataGridView1.Refresh(); }