private void EditDOC() { if (adgvDOCs.Rows.Count == 0) { return; } FrmDOC form = new FrmDOC(); form.docID = adgvDOCs.CurrentRow.Cells["DOC_ID"].Value.ToString(); form.docText = adgvDOCs.CurrentRow.Cells["DOC_TEXT"].Value.ToString(); form.recordID = Convert.ToInt32(adgvDOCs.CurrentRow.Cells["ID"].Value); if (form.ShowDialog() == DialogResult.OK) { if (form.dataChanged) { dataChanged = true; int col = adgvDOCs.CurrentCell.ColumnIndex; int row = adgvDOCs.CurrentCell.RowIndex; if (DS.Tables.Contains("DOCS")) { DS.Tables["DOCS"].Clear(); } docAdapter.Fill(DS, "DOCS"); adgvDOCs.CurrentCell = adgvDOCs[col, row]; } } }
private void btnNew_Click(object sender, EventArgs e) { FrmDOC form = new FrmDOC(); form.docID = ""; form.docText = ""; form.recordID = 0; if (form.ShowDialog() == DialogResult.OK) { dataChanged = true; if (DS.Tables.Contains("DOCS")) { DS.Tables["DOCS"].Clear(); } docAdapter.Fill(DS, "DOCS"); MainForm.LocateAdvGridRecord(form.docID, "DOC_ID", 1, adgvDOCs); } }