473,324 Members | 2,002 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,324 software developers and data experts.

How to catch a click on webbrowser :(

Hi

I want to catch the clicks for a special hyperlink on a webbrowser component
in order to activate the print setup section of my program. I cannot use
javascript because I must handle the printable document, in fact, create it
dynamically using program. I got stuck here, how can I do that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks
Feb 28 '07 #1
3 12230
The HTML page hosted in WebBrowser component can call back the application.
You need to add a little thing in the HTML file to handle the onclick event
of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string as
a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
"Aleyna[]" <xo******@gmail.comha scritto nel messaggio
news:Oq**************@TK2MSFTNGP06.phx.gbl...
Hi

I want to catch the clicks for a special hyperlink on a webbrowser
component in order to activate the print setup section of my program. I
cannot use javascript because I must handle the printable document, in
fact, create it dynamically using program. I got stuck here, how can I do
that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks


Feb 28 '07 #2
Am Wed, 28 Feb 2007 19:04:05 +0100 schrieb Laura T.:
The HTML page hosted in WebBrowser component can call back the application.
You need to add a little thing in the HTML file to handle the onclick event
of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string as
a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
Interesting!

I have a similar need: I need to access the DOM element a user identifies
with the mouse. (Background: user is interested in certain parts of a
webpage and wants to have the data extracted). Is there a possibility to
find the element in the DOM the mouse is over or clicked etc, without
adding anything to the page?

Tnx!
Mar 1 '07 #3
Thanks for your reply Laura.

I tried it and it works exactly as I want.

"Laura T." <LT@NOWHERE.COM>, haber iletisinde şunları
yazdı:%2***************@TK2MSFTNGP05.phx.gbl...
The HTML page hosted in WebBrowser component can call back the
application.
You need to add a little thing in the HTML file to handle the onclick
event of the special link:
Like this:
<a href="whatever" onclick="window.external.Test('called from script
code')">CLICK ME</a>

When clicked, the page will call your apps Test method passing the string
as a parameter.
This way you can make callbacks from the page to your app.
Just remember to set the ObjectForScripting property to this
(webBrowser1.ObjectForScripting=this;).
"Aleyna[]" <xo******@gmail.comha scritto nel messaggio
news:Oq**************@TK2MSFTNGP06.phx.gbl...
>Hi

I want to catch the clicks for a special hyperlink on a webbrowser
component in order to activate the print setup section of my program. I
cannot use javascript because I must handle the printable document, in
fact, create it dynamically using program. I got stuck here, how can I do
that?
Can I use a special javascript command that sends browser any message and
warn it or something like that?
Any idea?
appreciate any help...
Thanks



Mar 1 '07 #4

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

Similar topics

7
by: Robert May | last post by:
I have an application that uses the Ax web browser object. When I call the IHTMLElement.click() method on an input button (<input type="submit"> or <input type="button">), the click fires...
24
by: ej1002 | last post by:
Hi I have developed a Windows Application(C# Windows Form) which will get the IFrame Source of the page it is navigating using Webbrowser Control. Now I want do this in ASP.Net web application(C#...
11
by: Terry Olsen | last post by:
How can I catch a right-click on a DropDownMenuItem?
2
by: cweeks78681 | last post by:
I am porting some VB6 code that automates navigation through a web page by getting all the <a> tags into a collection and then calling the Click method on the appropriate one. How do I click a...
3
by: cweeks | last post by:
I use the InvokeMember("Click") method of HtmlElement to click a button in a web page using the Webbrowser control that is new in VS 2005 C# Express. Now I need to be able to select a member of a...
0
by: Steph | last post by:
hello, i testing webbrowser (c# .net2) , and my webbrowser take a random website in google (to test). and.... i found a problem with a security alert.... in this site :...
2
by: JDeats | last post by:
Using VS.NET 2005, if you place a WinForms WebBrowser control on a form, then place a command button on that form and in the "click" even handler for the command you do: webBrowser1.DocumentText...
0
by: cheenusri | last post by:
Hello friends, i am running slide show(pps file) in vb.net form using webbrowser control in it.while running the form, if right click on the slide, it show some popup menu, here i wan to...
1
by: Rotsey | last post by:
Hi, I have a form with a webbrowser control set to fill the form. I want to capture when the form is clicked. As the browser control is filling the form the user would click on the browser...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
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: 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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.