Solved

Raising An Event From the Webbrowser

Posted on 2002-07-15
3
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

752 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