private void Rename_Click() { if (WikiPageCur == null) { return; } FormWikiRename FormWR = new FormWikiRename(); FormWR.PageTitle = WikiPageCur.PageTitle; FormWR.ShowDialog(); if (FormWR.DialogResult != DialogResult.OK) { return; } WikiPages.Rename(WikiPageCur, FormWR.PageTitle); historyNav[historyNav.Count - (1 + historyNavBack)] = "wiki:" + FormWR.PageTitle; //keep history updated, do not decrement historyNavBack, stay at the same index in history //historyNavBack--;//no need to decrement history counter since we are loading the same page, just with a different name, historyNav was edited above with new name LoadWikiPage(FormWR.PageTitle); }