I
I
iRumba2014-12-12 09:25:06
.NET
iRumba, 2014-12-12 09:25:06

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

3 answer(s)
V
Vitaly Pukhov, 2014-12-12
@Neuroware

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?

M
mayorovp, 2014-12-12
@mayorovp

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.

A
Alexey, 2014-12-12
@Solexid

Максимум костылей давай - alert(this.id) на события(онклик итд) и обрабатывай события алерта в коде c#.Но я бы перешел на Awesomium.net

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question