Пример #1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            AddManagerForm upForm = new AddManagerForm();

            upForm.managerBindingSource.DataSource = managerDGVBindingSource;
            upForm.managerBindingSource.Position = managerDGVBindingSource.Position;

            if (upForm.ShowDialog() == DialogResult.OK)
            {
                managerDGVTableAdapter.Update(myDataBaseDataSet.ManagerDGV);
                int index = dataGridView1.CurrentRow.Index;
                this.managerDGVTableAdapter.Fill(this.myDataBaseDataSet.ManagerDGV);
                dataGridView1.CurrentCell = dataGridView1.Rows[index].Cells[2];
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddManagerForm addForm = new AddManagerForm();
            managerDGVBindingSource.AddNew();

            addForm.managerBindingSource.DataSource = managerDGVBindingSource;
            addForm.managerBindingSource.Position = managerDGVBindingSource.Position;

            if (addForm.ShowDialog() == DialogResult.OK)
            {
                managerDGVTableAdapter.Update(myDataBaseDataSet.ManagerDGV);
                this.managerDGVTableAdapter.Fill(this.myDataBaseDataSet.ManagerDGV);
                dataGridView1.CurrentCell = dataGridView1.Rows[managerDGVBindingSource.Count - 1].Cells[2];
            }
        }