views:

259

answers:

1

Hi, I have problem with WebBrowser component. For some reason, when I click into it, it disables me from setting focus on richTextBox.

I have 2 almost the same forms.

Main difference between first and second form is, that form1 is modifying WebBrowser DocumentText and form2 is using webBrowser to display content of temporary file.

First form is working very well, WebBrowser is not disabling focus on richTextBox. But second form is problematic one. When you click into WebBrowser component, and than back into richtextBox, it never gains focus by Focus() method again :(

A: 

I solved it :) I added while loop which waits, until webBrowser.Document property is completely initialized. Than I used webBrowser.Document.CreateElement for creating new html elements, and webBrowser.Document.Body.AppendChild to adding them into document. (I stopped using temporary file...)

Klinki