// save new entry (complete) // else = edit current selected enry ( to be complete ) private void btn_save_Click(object sender, EventArgs e) { if (tickBox_editMode.Checked == false) { if (tb_clientName.Text == "") { MessageBox.Show("Clients Name can not be empty"); return; } //normal save mode ( more error checking required - also option on button save yes / no string message = "You are about to add a new Client: " + tb_clientName.Text; string caption = "ClientTable"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); if (result == DialogResult.Yes) { sql.InsertNewClientData(FM_LoginScreen.conString, "ClientTable", tb_clientName.Text , tb_addressL1.Text, tb_addressL2.Text, tb_postcode.Text, tb_city.Text, tb_telephone.Text, tb_mobile.Text, tb_email.Text); // set fields back to blank Clear_fields(); } } else { //editing a row in the database ( to be complete ) if (tickBox_editMode.Checked) { string message = "You are about to save your changes to Client: " + tb_clientName.Text; string caption = "ClientTable"; MessageBoxButtons buttons = MessageBoxButtons.YesNo; DialogResult result = MessageBox.Show(message, caption, buttons); if (result == DialogResult.Yes) { sql.UpdateChangesClientTable(FM_LoginScreen.conString, "ClientTable", Convert.ToInt32(cb_clientselection.Text) , tb_clientName.Text, tb_addressL1.Text, tb_addressL2.Text, tb_postcode.Text , tb_city.Text, tb_telephone.Text, tb_mobile.Text, tb_email.Text); tickBox_editMode.Checked = false; } } } }