Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3491
  • Last Modified:

How to disable backspace button in a web browser control + C# win forms

Hi,

I would like to disable back space button for web browser control. even though if the user presses backspace button it should not navigate to previous page.

I'm using vs 2005 . is there any way to do that.

Thanks in advance.
0
MEDIZ
Asked:
MEDIZ
1 Solution
 
Varghese JacobAssistant Project ManagerCommented:
Hope the below link will help you.
http://www.webmasterworld.com/forum91/4699.htm
0
 
DhaestCommented:
Another remark: disabling the back-button !

I have had a lot of people ask, "How to I disable the back button?" or, "How do I prevent a user from clicking the back button and going back to the previous screen?" In fact, this is one of the most commonly asked questions on the ASPMessageboard and, sadly, the answer is quite simple: You CANNOT disable the back button of the browser.

Source: http://www.4guysfromrolla.com/webtech/111500-1.shtml
0
 
Subrat (C++ windows/Linux)Software EngineerCommented:
Work arround might be keyboard hook. While user press back btn, display a message like "Sorry! can't go back"
0
 
davesgonebananasCommented:
You can subclass the WebBrowser control and override the PreProcessMessage function.  However, if you filter out all Backspace key events then users won't be able to delete mistakes in forms :/
    public partial class MyWebBrowser : System.Windows.Forms.WebBrowser
    {
        public MyWebBrowser()
        {
            InitializeComponent();
        }

        public MyWebBrowser(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        public override bool PreProcessMessage(ref System.Windows.Forms.Message msg)
        {
            if ((msg.Msg == 0x100) && (msg.WParam == (IntPtr)Keys.Back)) 
            {
               // return true;
            }

            return base.PreProcessMessage(ref msg);
        }

    }

Open in new window

0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now