Exemplo n.º 1
0
 private void btnAddTask_Click(object sender, EventArgs e)
 {
     // Open frmTaskDetails with all fields blank.
     frmTaskDetails newTask = new frmTaskDetails();
     newTask.FormClosed += TaskDetails_FormClosed;
     newTask.Show();
 }
Exemplo n.º 2
0
        private void btnEditTask_Click(object sender, EventArgs e)
        {
            DataRow selectedRow;

            if (dataGrdTasks.SelectedRows.Count != 0)
            {
                // Get the currently selected row.
                selectedRow = ((DataRowView)dataGrdTasks.SelectedRows[0].DataBoundItem).Row;

                // Open frmClientDetails with the values of the selected row filled in.
                frmTaskDetails editTask = new frmTaskDetails(selectedRow);
                editTask.FormClosed += TaskDetails_FormClosed;
                editTask.Show();
            }
            else
            {
                MessageBox.Show("Please select a task to edit.", "No Selection", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }