At the moment the HTMLEditor does not support the idea of a 'Dirty' flag. If you wish to use this functionality then you have to implement it yourself. The technique involved is a little abstruse, but straightforward enough to implement. The steps are as follows:
This can be done at the form level or any other encapsulating class
Private mobjChangeLog As mshtml.IHTMLChangeLog Private DocumentMarkupCtr2 As mshtml.IMarkupContainer2 Private WithEvents MyChangeMonitor as New ChangeMonitor
ChangeMonitor should implement the IHTMLChangeSink interface:
<Runtime.InteropServices.ComVisible(True)> _ Public Class ChangeMonitor Implements mshtml.IHTMLChangeSink Public Event ContentChanged() Public Dirty As Boolean Public Sub Notify() Implements mshtml.IHTMLChangeSink.Notify Dirty = True RaiseEvent ContentChanged() End Sub End Class
Then, when the ReadyStateChange event is raised by the HTMLEditor, bind the classes:
DocumentMarkupCtr2 = CType(HTMLEditor.Document, mshtml.IMarkupContainer2) With DocumentMarkupCtr2 .CreateChangeLog(MyChangeMonitor, mobjChangeLog, 1, 1) End With
The IHTMLChangeSink.Notify method is then called on MyChangeMonitor to inform the class of changes to the top level DocumentMarkupCtr2. You can set a flag in the body of this method, or perform other appropriate actions.