private void button1_Click(object sender, EventArgs e) { Account_BO account_BO = new Account_BO(); ArrayList note = new ArrayList(); dataGridView1.Rows.Clear(); note = account_BO.getNote(); int f = 0; for (int i = 0; i < note.Count; i++) { if (viewTimePicker.Text == note[i].ToString()) { for (int j = i+1; note[j].ToString() != "*"; j++) { dataGridView1.Rows.Add(note[i].ToString(), note[j].ToString()); f = 1; } } } if (f == 0) MessageBox.Show("This date is not exist"); }
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 !!"); } }