Link to home
Start Free TrialLog in
Avatar of hongjun
hongjunFlag for Singapore

asked on

Disable Web Browser Show Document Modified Prompt

I have created an HTML editor. In my application, I have a toolbar to toggle visiblity of a webbrowser control and a multiline textbox control to show HTML page and HTML source respectively.

All is working fine except let's say I input "Hello World" as input in HTML mode, then click the toggle button to switch to Text Mode, I will see the HTML source correctly. However, when I tried to toggle back to HTML mode, I will get a prompt telling me "document has been modified". How do I disable this prompt from appearing?

I shall attach the screen for the "dialog" in a short while.

Below is my code fragment.
        private void viewButton_Click(object sender, EventArgs e)
        {
            if (viewButton.Text == "HTML")
            {
                txtEditor.Text = webBrowser1.DocumentText;
                txtEditor.Visible = true;
                webBrowser1.Visible = false;
                viewButton.Text = "TEXT";
            }
            else
            {
                webBrowser1.DocumentText = txtEditor.Text;
                txtEditor.Visible = false;
                webBrowser1.Visible = true;
                viewButton.Text = "HTML";
            }
        }
Avatar of hongjun
hongjun
Flag of Singapore image

ASKER

ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hongjun

ASKER

I will try that tonight.

hongjun
Avatar of hongjun

ASKER

>> webBrowser1.AllowNavigation = false;
is sufficient for me.

hongjun
Avatar of hongjun

ASKER

thanks :)