473,406 Members | 2,620 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,406 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 3340
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.