private void drugTypeDataGridView_RowLeave(object sender, DataGridViewCellEventArgs e) { if (drugTypeBindingSource == null) { return; } if (drugTypeDataGridView.Rows.Count <= 1) { return; } if (!drugTypeDataGridView.IsCurrentRowDirty) { return; } Validate(); drugTypeBindingSource.EndEdit(); var iResult = DrugTypeManager.Save((DrugType)drugTypeBindingSource.Current); toolStripStatusLabel1.Text = iResult > 0 ? @"Drug Type saved successfully." : @"Error occurred when saving Unit."; }