Exemple #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            // if(dataGridView1.SelectedRows.c.get.SelectedRows)
            EditUserForm fm = new EditUserForm(new User(), true);

            if (fm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FillGrid();
            }
        }
Exemple #2
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            User user = new User();

            user.userID  = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
            user.name    = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
            user.sex     = dataGridView1.SelectedRows[0].Cells[2].Value.ToString();
            user.age     = Convert.ToInt32(dataGridView1.SelectedRows[0].Cells[3].Value.ToString());
            user.cityNo  = dataGridView1.SelectedRows[0].Cells[4].Value.ToString();
            user.summary = dataGridView1.SelectedRows[0].Cells[5].Value.ToString();

            EditUserForm fm = new EditUserForm(user, false);

            if (fm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                FillGrid();
            }
        }