internal static void Copy(Form1 form) { WebBrowser helpWebBrowser = (WebBrowser)form.splitContainer1.Panel2.Controls["helpWebBrowser"]; //form.helpWebBrowser; CustomToolStripTextBox urlToolStripTextBox = form.urlToolStripTextBox; TextBox searchTextBox = form.searchTextBox; if (urlToolStripTextBox.Focused && !String.IsNullOrEmpty(urlToolStripTextBox.SelectedText)) { urlToolStripTextBox.Copy(); } else if (searchTextBox.Focused && !String.IsNullOrEmpty(searchTextBox.SelectedText)) { searchTextBox.Copy(); } else if (helpWebBrowser.Document != null) { helpWebBrowser.Document.ExecCommand("Copy", false, null); } }