122
0 vote vote

[ Resolved ]

Sometimes, the HtmlChanged Event does not get fired immediately.

Steps to regenerate

Hi,

I have an application that uses the .NET Win HTML Editor Control. Within the application I handle the HtmlChanged event. I noticed this event doesn't fire immediately. Is it possible to change this? Can you please assist?

For example, my application has some standard text boxes and the HTML Editor Control. When I open an existing item for editing, I set the value of the text boxes and the BodyHtml of the HTML Control. This is all done inside the one method.

When the textboxes have their values set, the method that handles the textchanged event for the textboxes if fired immediately, however themethod that handles htmlchanged event for the HTML Control does not fire until the enclosing method is complete. This affects the state of the form. Here is a code example:

Private Sub Init(dr As DataTabRow)
Try

txtTitle.Text = dr.Title ' RequiredTextChanged event is raised and handled immediately
txtSummary.Text = dr.Summary ' RequiredTextChanged event is raised and handled immediately
htmlNewsItem.BodyHtml = dr.Content ' RequiredTextChanged event is NOT raised now ??? It will be raised AFTER Init() has completed. This is no good, as btnUpdate is enabled when initially it needs to be disabled.

btnUpdate.Enabled = False

Catch ex As Exception
Throw New Exception("[" Me.Name "].Init()", ex)
End Try
End Sub

Private Sub RequiredTextChanged(sender As Object, e As System.EventArgs) Handles txtTitle.TextChanged, txtSummary.TextChanged, htmlNewsItem.HtmlChanged
btnUpdate.Enabled = True
End Sub
Please feel free to share your comment.
loading...