private void buttonclear_Click(object sender, EventArgs e) { text_contact.Clear(); txtMobNumber.Clear(); RTB_AddNotes.Clear(); Lab_InvalidNumber.Visible = false; buttonsave.Text = "Save"; }
private void buttonsave_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(text_contact.Text) && txtMobNumber.Text != "") { if (txtMobNumber.TextLength != 10) { MessageBox.Show("Enter the mobile number.. !!", "Data not found.. ", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (buttonsave.Text == "Save") { int i = this.cntrl.Save(text_contact.Text, txtMobNumber.Text, RTB_AddNotes.Text); if (i > 0) { MessageBox.Show("Successfully Saved !!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { int i = this.cntrl.Update(ContactId, text_contact.Text, txtMobNumber.Text, RTB_AddNotes.Text); if (i > 0) { MessageBox.Show("Successfully Updated !!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } } text_contact.Clear(); txtMobNumber.Clear(); RTB_AddNotes.Clear(); DataTable dtb = this.cntrl.FillGrid(); Fill_ContactGrid(dtb); } else { MessageBox.Show("Data Not Found..!!!", "Empty Field", MessageBoxButtons.OK, MessageBoxIcon.Information); text_contact.Focus(); } }