473,387 Members | 1,486 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Expand|Select|Wrap|Line Numbers
  1.   private void txtURL_KeyDown(object sender, KeyEventArgs e)
  2.         {
  3.             if (e.KeyCode == Keys.Enter)
  4.             {
  5.                 GoTo(txtURL.Text);
  6.             }
  7.         }
  8.  private void GoTo(String strUrl)
  9.         {
  10.             if (String.IsNullOrEmpty(strUrl)) return;
  11.             if (strUrl.Equals("about:blank")) return;
  12.             if (!strUrl.StartsWith("http://"))
  13.                 strUrl = "http://" + strUrl;
  14.             try
  15.             {
  16.  
  17.                 webBrowser1.Navigate(new Uri(strUrl));
  18.             }
  19.             catch (System.UriFormatException)
  20.             {
  21.                 return;
  22.             }
  23.  
  24.  
  25.         }
Sep 22 '11 #1
1 2034
Curtis Rutland
3,256 Expert 2GB
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.
Sep 22 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Coder | last post by:
hi, there is still no answer, i wonder if there is a way to handle the multiple key-press event on a C# windows form, like "Ctrl+Enter"
9
by: Mike L | last post by:
I tried a sample of code in MSDN magazine, but now I'm stuck. What code has the best performance to populate a Data Grid with a SP? Below is the code I have, which might be completing the wrong...
0
by: VM | last post by:
I have a pretty big application made in C but I only want to view the code that's being executed when a button in a toolbar is clicked. Since I didn't write the program, is there an easy way to...
4
by: eewwttww | last post by:
how to save with only WebBrowser: save html+picture without dialog box? what I Have is: WebBrowser.ExecWB OLECMDID_SAVEAS, OLECMDEXECOPT_PROMPTUSER, 300, 300 I don't want this code. I want...
1
by: eewwttww | last post by:
how to show the "txt code" that the WebBrowser wont to save when he wont to save html+pictures with the "dialogbox" - before saving. this is the code to open the save "dialogbox" ...
5
by: eewwttww | last post by:
how to show the html code that the WebBrowser want to save when he want to save html+pictures with the "dialogbox" - before saving. this is the code to open the save "dialogbox" ...
1
by: Mateusz Rajca | last post by:
Hello, What code should I write to hide the taskbar? Mateusz
3
by: yuelinniao | last post by:
hi, I have got a simple way to make "textarea" support "auto-submit" when pressing Ctrl+Enter, and tested under both IE and Firefox. The common old method is like this: <form name=form2>...
5
by: teric2 | last post by:
Hi everyone! I have a form based on a table "Return Info" with a text box and a combo box. When ever a new record is created by the form using the combo box I want to create a new record in a...
4
by: BlackMustard | last post by:
hello, i have a userform in a vba macro which contains three text boxes. sometimes i want to fill in only the first one, and other times one or two of the other as well. when i today want to leave...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.