473,320 Members | 1,858 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

.NET form and Web Browser control

I have a .NET VB form that contains a Web Browser control. In the document in
the Web Browser I have JavaScript that responds to certain click events
within nodes (not buttons or other controls). How do I get information about
the click event back to the parent VB form? I want the parent form to update
certain information based on the ID of the node.
Nov 22 '05 #1
1 3331
1. Include a reference to MSHTML
2. Obtain a reference to the document object. You will notice that the
MSHTML library contains and HTMLDocument Class that you can use as a
reference type.

E.G.
Dim doc as HTMLDocument = AxWebBrowser1.document

I would do this on an AfterNavigate2 event.

3. Using the document class you'll be able to get a reference to the
specific element that raises the event. (use the getElementById method)

4. After you have a reference to the element, you will be able to set up
event handlers for events raised by that specific html element. Just remeber
to declare the reference withevents.

e.g. (to handle node clicks from a telerik treeview i did the following)

Protected WithEvents HtmlDiv_TvwApplications As mshtml.HTMLDivElementClass
.....

HtmlDiv_TvwApplications = HtmlDoc_Document.getElementById("elementname")

'this is how i declared the event handlers

Private Function TreeContextDblClick(ByVal e As mshtml.IHTMLEventObj) As
Boolean Handles HtmlDiv_TvwApplications.HTMLElementEvents2_Event_o ndblclick

'You can get more info on the element that generated the event from "e"
Dim att As String = e.srcElement.parentElement.getAttribute("rtvalue")
'code in here
end function

Hope that points you in the right direction

Sasa Milovic
..Net Developer

"mfdatsw1" wrote:
I have a .NET VB form that contains a Web Browser control. In the document in
the Web Browser I have JavaScript that responds to certain click events
within nodes (not buttons or other controls). How do I get information about
the click event back to the parent VB form? I want the parent form to update
certain information based on the ID of the node.

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Noozer | last post by:
We have a web based tool used to report issues in our office. Many times the users do not enter the required information to deal with the issue. Unfortunately we don't have control of this...
32
by: Eli | last post by:
How can I POST a form into a new window where I control the size and other attributes of the new window? Also. Are there any implications, perhaps due to browser security (Interne Explorer?)...
7
by: Mike | last post by:
Hi! I posted this question in browser_ctl group as well but got no results. I have a form with embedded WebBrowser. Upon clicking on a link in the embedded webbrowser that calls JavaScript's...
6
by: Peter Wone | last post by:
Hosting the WebBrowser control is easy. Customising it is not. You have to implement IDocHostShowUI, IDocHostUIHandler, IDocHostUIHandler2, and IOleClientSite, not one of which appears in a typelib...
2
by: Miky | last post by:
Hi, I have the following problem: I have a .CFM web page and I have to populate, from VB, two textboxes on it. I was thinking using sendkeys (even if I don't like it too much) but when I...
5
by: | last post by:
When completing certain types of transactions, the users of my app will need to have the clients sign an authorization form. I want to add a button to the page that allows them to print the auth...
7
by: jmp | last post by:
(I hope this isn't considered too far off-topic.) I work as a developer on a browser product found on handheld devices, and I'm trying to specify behavior for the browser to make it "as...
5
by: jeremy | last post by:
I have an ASP.Net 2.0 application running on Windows Server 2003. The application displays properly in Internet Explorer, however, when I use a browser control embedded in a .net form, I get an...
11
by: newbie | last post by:
i have a form in which a hidden field (initial value as '0', and my javascript set it to '1' when an event is trigged). In the same form, i have a reset field. But I realized that the hidden field...
0
by: =?Utf-8?B?Q29kZVJhem9y?= | last post by:
Hi, I have a windows control containing the web browser control. The user makes some changes to the form in the web browser control, and then the data is saved. I now need to convert this...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.