Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
viewing source code from eclipse 13 74
static class 3 53
ShiftLeft challenge 21 66
firstChar challenge 13 86
The Fluent Interface Design Pattern You can use the Fluent Interface (http://en.wikipedia.org/wiki/Fluent_interface) design pattern to make your PHP code easier to read and maintain.  "Fluent Interface" is an object-oriented design pattern that r…
"Disruption" is the most feared word for C-level executives these days. They agonize over their industry being disturbed by another player - most likely by startups.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

760 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

20 Experts available now in Live!

Get 1:1 Help Now