Solved

Raising An Event From the Webbrowser

Posted on 2002-07-15
3
176 Views
Last Modified: 2010-07-27
I want to build a small table using HTML and then display this table in the Webbrowser Control.  When a user clicks on a row, I want to let the (container) visual basic form know which row was clicked.  

After the row is clicked, a corrisponding routine will be executed by the vb form.

How do I perform this interaction without using a timer to poll the HTML document?
0
Comment
Question by:khampton
3 Comments
 
LVL 2

Expert Comment

by:Ber
ID: 7155821
I'm not sure but I think you need to write an Event handler to do this, an example of an event handler in VB is available here...

http://www.codeguru.com/vb/articles/1721_GridResize_Src.zip

Info on it is available here...

http://www.codeguru.com/vb/articles/1721.shtml


Cheers...
Ber...
0
 
LVL 1

Expert Comment

by:soferstam
ID: 7155895
Did you try parent.parent.pa....  or something like this from javascript?
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 50 total points
ID: 7157208
Should work something like:

Dim WithEvents htmlDoc As HTMLDocument


Private Sub WebBrowser_DocumentComplete(...)
   If (pDisp Is WebBrowser.object) Then
      Set htmlDoc = WebBrowser.Document
   End If
End Sub

Private Sub htmlDoc_onclick()
   MsgBox window.event.srcElement.<attribute-name>
End Sub


What will you use to distinguish the rows?  HTML rows arent assigned numbers, so to speak, by default, I dont think.  Perhaps you could number them manually using their "id" attribute and use srcElement.id
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question