raising an event from an activeX control on a htm page in a webbrower control 
Author Message
 raising an event from an activeX control on a htm page in a webbrower control

I have written some activeX controls that contain a number of text
boxes and combo boxes. I am using the activeX control as a property
sheet for a program that I am writing. If I was to embed the activeX
control on a htm page wouldn't it then run in an Internet browser. I
then want to display the htm page with the ActiveX control on a
WebBrowser control on a VB form. Is there a way that I can trap the
ActiveX's custom events through the WebBrowser control?
I want to embed the ActiveX control in a htm page so that I can load
my controls or a web page at run time.
At the moment I am loading the ActiveX control dynamically using a
VBControlExtender but would rather go the html page route.
Thank for any help,
Johnny


Sat, 03 Sep 2005 22:53:34 GMT  
 raising an event from an activeX control on a htm page in a webbrower control

Quote:

> I have written some activeX controls that contain a number of text
> boxes and combo boxes. I am using the activeX control as a property
> sheet for a program that I am writing. If I was to embed the activeX
> control on a htm page wouldn't it then run in an Internet browser. I
> then want to display the htm page with the ActiveX control on a
> WebBrowser control on a VB form. Is there a way that I can trap the
> ActiveX's custom events through the WebBrowser control?
> I want to embed the ActiveX control in a htm page so that I can load
> my controls or a web page at run time.
> At the moment I am loading the ActiveX control dynamically using a
> VBControlExtender but would rather go the html page route.
> Thank for any help,
> Johnny

You can get the events in the HTML page by using the <SCRIPT> tag:

<SCRIPT language=JavaScript for=ObjectID event=MyEvent>
// code here
</SCRIPT>

If you want to catch the events of the control in the form, first add the
control library to the project references (not components). Then declare a
variable of the control type using WithEvents:

Dim WithEvents MyObjInHTML As MyControl

In the DocumentComplete event of the WebBrowser control get the control
instance from the document:

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As
Variant)

   Set MyObjInHTML = WebBrowser1.Document.getElementById("ObjectID").Object

End Sub

Then use the MyObjInHTML variable to receive events and interact with the
control from the form code.

--
Eduardo A. Morcillo [MS MVP - VB]
http://www.domaindlx.com/e_morcillo



Sun, 04 Sep 2005 05:58:04 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. raising an event from an activeX control on a htm page in a webbrower control

2. Using Webbrower control to save a page

3. Mouseover event on webbrower control

4. Raising Custom Active X Controls Events when using Data Repeater Control

5. Can an ActiveX Control on a Web Page subscribe to a COM+ Event

6. ActiveX control event not working when in asp.net page

7. Can an ActiveX Control on a Web Page subscribe to a COM+ Event

8. Detecting which control raised an event

9. HELP!!! raising events from a custom control

10. How to Raise/Simluate an Event via Code for a existing Control

11. Help Raising Events in User Controls

12. Q: Raising events in webbrowser control

 

 
Powered by phpBB® Forum Software