Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
| Search | Today's Posts | Mark Forums Read
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 16th, 2003, 02:50 PM
roy roy is offline
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default consuming events from axWebBrowser

Hi.
I have some qusetion, I couldn't find almost any documentation about it.
I hope that someone can help.

I embedded a Activex IE browser in a win app ( .NET ).
I was able to raise events from the axWebBrowser and to bind it to an event handler on the win form container.

1. I wasn't able to pass arguments with the event
(for example, passing the value of a text box on
chage event, from the axWebBrowser to the container(win
    app).
2. How can I respond to events in the axWebBrowser that were raised on the container ( my idea is that I need to trigger an event in the axWebBrowser , because it is an event driven environment, and then call a javascript function ( "event handler").
How can I trigger a btn click event, in the axWebBrowser from the container?

3. Is it possible to exchange COM objects ( not just a simple string),
between the container and the axWebBrowser ?


Thank you very much
roy
  #2 (permalink)  
Old August 1st, 2005, 10:59 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by roy
 Hi.
I have some qusetion, I couldn't find almost any documentation about it.
I hope that someone can help.

I embedded a Activex IE browser in a win app ( .NET ).
I was able to raise events from the axWebBrowser and to bind it to an event handler on the win form container.

1. I wasn't able to pass arguments with the event
(for example, passing the value of a text box on
chage event, from the axWebBrowser to the container(win
    app).
2. How can I respond to events in the axWebBrowser that were raised on the container ( my idea is that I need to trigger an event in the axWebBrowser , because it is an event driven environment, and then call a javascript function ( "event handler").
How can I trigger a btn click event, in the axWebBrowser from the container?

3. Is it possible to exchange COM objects ( not just a simple string),
between the container and the axWebBrowser ?


Thank you very much
roy


I am trying to do the same thing

Can you please post how you were able tp raise events from the axWebBrowser and to bind it to an event handler on the win form container?

It would be a great help


  #3 (permalink)  
Old August 1st, 2005, 11:04 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found out how to click button from the container but could not found out how to raise event from the AxWebBrowser to the conatiner
I did it something like this in axWebBrowser1_DocumentComplete event


HTMLDocument myDoc = new HTMLDocumentClass();

myDoc = (HTMLDocument) axWebBrowser1.Document;
HTMLInputElement btnSearch = (HTMLInputElement) myDoc.all.item("btnI", 0);
btnSearch.click();

  #4 (permalink)  
Old March 9th, 2007, 04:08 AM
Registered User
 
Join Date: Aug 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Two ways to do it.
1.
On Document_complete event,
Iterate through all tags, find it and add an appropriate handler to it

Code would be something like

Private Sub WBBrowser_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEv entArgs) Handles WBBrowser.DocumentCompleted

' Now find the object as in the previous comment and now
  AddHandler htmlElement.Click, AddressOf Document_OnClick

2. The other and bit lengthy way is
Handle the click event of Document
Make a function which can return you the focused element
that would be something like

Public Function GetFocusedElement() As mshtml.IHTMLElement
        Dim focusedControl As mshtml.IHTMLElement
        If CType(CType(oldDocument, mshtml.HTMLDocument).selection, mshtml.IHTMLSelectionObject).type = "Control" Then
            focusedControl = CType(oldDocument.selection.createRange(), mshtml.IHTMLControlRange).item(0)
        Else
            focusedControl = CType(oldDocument.selection.createRange(), mshtml.IHTMLTxtRange).parentElement
        End If
        Return focusedControl
    End Function


Now see if it is the required element. if it is .. do what ever you want to do with it






Similar Threads
Thread Thread Starter Forum Replies Last Post
consuming a webservice aklilu Classic ASP XML 0 May 13th, 2008 01:55 PM
problem with AxWebBrowser in Visual Studio 2003 Mystic C# 0 February 20th, 2007 09:38 AM
axWebBrowser: DocumentComplete SebFr C# 0 October 27th, 2006 03:06 PM
Consuming WMI Events skin C# 1 November 22nd, 2004 06:55 PM
axWebBrowser NOT registered??? Ron Howerton General .NET 0 June 1st, 2004 08:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.