Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2010-09-15
4
Medium Priority
?
3,445 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 1000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Article by: evilrix
Looking for a way to avoid searching through large data sets for data that doesn't exist? A Bloom Filter might be what you need. This data structure is a probabilistic filter that allows you to avoid unnecessary searches when you know the data defin…
The viewer will learn how to implement Singleton Design Pattern in Java.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
Suggested Courses

610 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