Answer the question
In order to leave comments, you need to log in
How to catch WebBrowser events in .net program?
There is a program (in my case on VB.Net 2010)
There is a WebBrowser control
So, everything that is displayed in the browser document is not opened from a file, but is formed on the go during the execution of the program. And I would like to catch the user's actions with elements in the program.
That is, a text field appears in the browser. The user can enter something there, and the program must know that the element received focus, was clicked on, it became active, the text in it was changed. Then there is a button that you can click on. At the same time, I need to know which button I clicked, that is, the button ID or a link to the HtmlElement instance should be sent to the handler, because there can be a different number of controls and I don’t know which one (do not write a handler for each). In short, I want to work with controls in the browser to work like normal form controls. Is it possible? In theory, WebBrowser can handle OnClick events within itself, passing control to scripts inside the document, why not pass this event to a higher level?
I hope I explained well what I need.
Answer the question
In order to leave comments, you need to log in
Sounds like an unsuccessful crutch, replacing the mechanism of dynamic creation of elements, what task was required to be solved initially, before being "born" in the webbrowser program and other things?
You want something very strange, and something in your program is definitely superfluous: either WebBrowser or the rest of the program :) In the first case, study XAML, everything you try to do in WebBrowser can be done on it. In the second case - create a web application in ASP.NET and open it in a regular browser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question