Solved

Raising An Event From the Webbrowser

Posted on 2002-07-15
3
175 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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