Solved

Raising An Event From the Webbrowser

Posted on 2002-07-15
3
163 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
Comment Utility
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
Comment Utility
Did you try parent.parent.pa....  or something like this from javascript?
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 50 total points
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now