Click here to Skip to main content
15,886,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Iam using Visual Basic 2010 Proffisional

When I set the webbrowser (IE 9) control to editing mode, I can't change the html source code of it. for example when I add this code into button_click event :

WebBrowser1.DocumentText = "Hellooo" All document Text become nothing (Delets all things in DocumentText)

so I mean I want to open existing HTML file in editing mode, and edit it with design mode and code text too.

the code I used to set the webBrowser into Designing mode is:

Me.WebBrowser1.Document.ExecCommand("EditMode", False, Nothing)

another problem for example when I want to add link to selected text I used this code:

Me.WebBrowser1.Document.ExecCommand("CreateLink", False, Nothing)

The problem of this code is the webBrowser control its link dialog, and I want to display my custom dialog... not for insert link only, but for insert image and other dialogs...

Best Regards,

AlSayed
Posted

1 solution

First, EditMode is not supported by IE (or the WebBrowser control).

As for displaying a custom dialog, you'll have to create the dialog and show it yourself to ask for the URL to insert. Executing CreateLink has nothing to do with showing the dialog.

The DefaultUserInterface parameter just tells the browser to either show the default dialog for creating the link or to show NO dialog at all. You don't get to tell it to show your dialog.
 
Share this answer
 
Comments
Abed AlSayed 25-Jun-12 10:10am    
But the Edit Mode for WebBrowser Control is enabled by my code and I've tested it and created html web pages for it
Dave Kreskowiak 25-Jun-12 11:41am    
And?? I said it wasn't supported. I didn't say it didn't work. What that means is, according to Microsoft, if you use it you're on your own. Don't expect to get support for it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900