예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DataRow newRow = contragents.NewRow();

            frmContragent frm = new frmContragent(newRow, true);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                contragents.Rows.Add(newRow);
                FillTable();
            }
        }
예제 #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgvMain.CurrentRow != null)
            {
                //string id = dgvMain.CurrentRow.Cells[0].Value.ToString();
                //DataRow row = contragents.Select("ID = " + id)[0];

                int     id  = Convert.ToInt32(dgvMain.CurrentRow.Cells[0].Value);
                DataRow row = contragents.Rows.Find(id);

                frmContragent frm = new frmContragent(row, false);
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    FillTable();
                }
            }
        }