Solved

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

Posted on 2010-09-15
4
3,270 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
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 8

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
haveThree challenge 22 114
copyEvens challenge 6 92
sumHeights2  challenge 7 88
factorial example challenge 10 94
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to implement Singleton Design Pattern in Java.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now