Solved

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

Posted on 2010-09-15
4
3,352 Views
Last Modified: 2012-05-10
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
Comment
Question by:MEDIZ
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Expert Comment

by:Varghese Jacob
ID: 33690271
Hope the below link will help you.
http://www.webmasterworld.com/forum91/4699.htm
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 33848203
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
 
LVL 9

Expert Comment

by:Subrat (C++ windows/Linux)
ID: 33930775
Work arround might be keyboard hook. While user press back btn, display a message like "Sorry! can't go back"
0
 
LVL 8

Accepted Solution

by:
davesgonebananas earned 250 total points
ID: 34098310
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Python - ImportError: No module named 'urllib2' 2 518
base64 decode encode 12 193
PHP question(s) about order of output 9 75
rhino JavaScript import, load 25 130
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question