Why cannot edit/input text in .NET WebBrowser control on IE9+ system?

Posted by Admin L in .NET Programming on 19-11-2012. Tags: , , , , , , , , , , ,

Author: Nosa Lee
Original Address: https://www.seeksunslowly.com/edit-input-text-dot-net-webbrowser-control-ie9
To reprint this article, please indicate the source, thank you.

For instance: your WebBrowser is named as wb, then the following code can let WebBrowser control to be editable:
[cc lang=”vbnet”]
Private Sub wb_DocumentCompleted(ByVal sender As Object, _
ByVal e As WebBrowserDocumentCompletedEventArgs) _
Handles wb.DocumentCompleted
wb.Document.DomDocument.DesignMode = “on”
End Sub

Note: if you do not consider IE9, you only need to set DesignMode as “on”, so, the important sentence is: wb.Document.Write(wb.DocumentText), that is writing the HTML source code or WebBrowser compulsorily first.

【赞赏 / Reward】

微信         支付宝         PayPal

Post a comment