private void button1_Click(object sender, EventArgs e) { Bookmarks b = new Bookmarks(); if (b.CheckIfBookmarkExists(t_Name.Text, t_Path.Text)) { MessageBox.Show("Bookmark already exists!"); } else { b.CreateNewBookmark(t_Name.Text, t_Path.Text); this.DialogResult = DialogResult.OK; Close(); } }