private void saveCost_btn_Click(object sender, EventArgs e) { try{ Account_BO ab = new Account_BO(); ArrayList note = new ArrayList(); ArrayList temp = new ArrayList(); note = ab.getNote(); int f = 0; for (int i = 0; i < note.Count; i++) { temp.Add(note[i].ToString()); if (note[i].ToString() == entryDtp.Text) { temp.Add(writeNote_txt.Text); for (int m = i + 1; m < note.Count ; m++) { temp.Add(note[m].ToString()); } ab.setNote(temp); MessageBox.Show("Save Successfully Done"); entryDtp.ResetText(); writeNote_txt.Clear(); f = 1; break; } } if (f == 0) { note.Add(entryDtp.Text); note.Add(writeNote_txt.Text); note.Add("*"); ab.setNote(note); MessageBox.Show("Save Successfully Done"); entryDtp.ResetText(); writeNote_txt.Clear(); } } catch(Exception) { MessageBox.Show("Error !!"); } }