Example #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var child = new AddOrEditForm {
                StartPosition = FormStartPosition.CenterParent, Text = @"添加"
            };

            child.ReloadDgv += Child_ReloadDgv;
            child.ShowDialog(this);
        }
Example #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            var selectedRow = dgvQuestions.CurrentRow;

            if (selectedRow == null)
            {
                MessageBox.Show(@"未选中任何行!");
                return;
            }

            var index = selectedRow.Index;
            var cells = dgvQuestions.Rows[index].Cells;
            var model = new Ct((int)cells["id"].Value, cells["tg"].Value.ToString(), cells["a"].Value.ToString(),
                               cells["b"].Value.ToString(), cells["c"].Value.ToString(), cells["d"].Value.ToString(),
                               cells["da"].Value.ToString());
            var child = new AddOrEditForm(model)
            {
                StartPosition = FormStartPosition.CenterParent, Text = @"修改"
            };

            child.ReloadDgv += Child_ReloadDgv;
            child.ShowDialog(this);
        }