what is the code for Ctrl + Enter in a webbrowser in c# .net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • santhosh1985
    New Member
    • Sep 2011
    • 2

    what is the code for Ctrl + Enter in a webbrowser in c# .net

    I am creating a webbrowser. If we ente googl in our url after press ctrl + enter . it will show www.google.com. But ctrl + Enter is not working. i m using this code but it is not working
    Code:
      private void txtURL_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    GoTo(txtURL.Text);
                }
            }
     private void GoTo(String strUrl)
            {
                if (String.IsNullOrEmpty(strUrl)) return;
                if (strUrl.Equals("about:blank")) return;
                if (!strUrl.StartsWith("http://"))
                    strUrl = "http://" + strUrl;
                try
                {
                    
                    webBrowser1.Navigate(new Uri(strUrl));
                }
                catch (System.UriFormatException)
                {
                    return;
                }
    
                
            }
    Last edited by Curtis Rutland; Sep 22 '11, 04:05 PM.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    The Ctrl+Enter shortcut is happening at the broswer level, not at your application level. It's caught by the browser and processed, and never sent to your application. You can't catch it.

    Comment

    Working...