Exemplo n.º 1
0
 private void btnAddClient_Click(object sender, EventArgs e)
 {
     // Open frmClientDetails with all fields blank.
     frmClientDetails newClient = new frmClientDetails();
     newClient.FormClosed += ClientDetails_FormClosed;
     newClient.Show();
 }
Exemplo n.º 2
0
        private void btnEditClient_Click(object sender, EventArgs e)
        {
            DataRow selectedRow;

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

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