コード例 #1
0
        private void buttonSaveChanges_Click(object sender, EventArgs e)
        {
            try
            {
                var result = MessageBox.Show("Are you sure ?", "Confirmation", MessageBoxButtons.OKCancel);

                if (result == DialogResult.OK)
                {
                    connectionDB.modifySignature(comboBoxName.Text, textBoxSignature.Text, idUser);  // Update database
                    if (checkBoxDefaultSignature.Checked == true)
                    {
                        Properties.Settings.Default.Signature = comboBoxName.Text;
                        Properties.Settings.Default.Save();                                     // Set the new default signature
                    }
                    MessageBox.Show("Signature updated successfully !");
                }
            }
            catch (Exception er)
            {
                MessageBox.Show("Error : couldn't update the database");
                MessageBox.Show(er.ToString());
            }
        }