public void MessageEdit() { MessageForm newMessage = new MessageForm(mParent.mainForm); ListView box; // Get the correct box if (String.Compare(mParent.mainForm.AssetManagerBoxesTabControl.SelectedTab.Name, "AssetManagerInboxTabPage", true) == 0) { box = mParent.mainForm.AssetManagerInboxMessagesListViewFilter; } else if (String.Compare(mParent.mainForm.AssetManagerBoxesTabControl.SelectedTab.Name, "AssetManagerOutboxTabPage", true) == 0) { box = mParent.mainForm.AssetManagerOutboxMessagesListViewFilter; } else { box = null; return; } // We can only edit one message no more or less if (box.SelectedItems.Count == 1) { foreach (ListViewItem item in box.SelectedItems) { newMessage.Open(item); newMessage.Show(); return; } } else { MOG_REPORT.ShowMessageBox("Edit message", "You can only edit one message at a time.", MessageBoxButtons.OK); return; } }