private void btnAdd_Click(object sender, EventArgs e) { if (txtSearch.Text != "") { txtSearch.Text = ""; } Note note = new Note(); NoteList.Insert(0, note); note.Click += Note_Click; note.check.CheckedChanged += Check_CheckedChanged; if (txtSearch.watermark != "All Notes" && txtSearch.watermark != "Delete") { note.tags.Add(currentTag); } if (flowNoteList.Controls.Contains(lblNoNote)) { flowNoteList.Controls.Remove(lblNoNote); } flowNoteList.Controls.Add(note); note.BringToFront(); if (currentTag == "All Notes") { flowNoteList.Controls.SetChildIndex(note, NoteSorting.getNoteIndex(NoteList, note, sort)); } else { flowNoteList.Controls.SetChildIndex(note, NoteSorting.getNoteIndex(NoteList, note, sort, currentTag)); } NoteClick(note); txtMain.Visible = true; flowTag.Visible = true; foreach (Control control in pnlSubmenu2.Controls) { control.Visible = true; } pnlDelete.Visible = false; }