HOWTO: Communicate with a UserDocument from a WebBrowser ControlLast reviewed: October 10, 1997Article ID: Q174921 |
The information in this article applies to:
SUMMARYThis article demonstrates a technique you can use to communicate with your UserDocument running in a WebBrowser control. You can use this technique to pass parameters to your UserDocuments if you are writing an application that has a WebBrowser control in which you display one or more UserDocuments.
MORE INFORMATIONYou can manipulate the UserDocument by adding Public Properties and Methods to the UserDocument. You can access these properties and methods from your WebBrowser application by using the Document property of the WebBrowser control. The Document property of the WebBrowser control exposes the Automation object of the currently displayed document. This article does not give details on creating WebBrowser control or UserDocument applications. Please see the REFERENCES section below for more information. For the purposes of understanding how this technique can be used, suppose you have following two projects: PROJECT 1. MYDOC:
Public Property Let CustomerID(ByVal iCustID As String) 'Load the customer data associated with iCustID End PropertyStep 2: Invoke the property of the currently-running UserDocument using the Document property of the WebBrowser control. From the example above, modify the MYBROWSER project to handle the Click event of the ListBox:
Private Sub lstContact_Click() Dim CustID As String 'retrieve customer id from the listbox CustID = lstContact.List(lstContact.ListIndex) 'tell the userdocument to load the customer brwWebBrowser.Document.CustomerID = CustID End SubNOTE: You can also use this technique when you display multiple UserDocuments within the WebBrowser control. Be aware that the Document property may not be available immediately after you use the Navigate method of the WebBrowser control. If this is the case, then you can use the Busy property of the WebBrowser control to wait until the browser has finished loading the document. Also, you can use the NavigateComplete event of the WebBrowser control to signal that the document has finished loading.
REFERENCESFor additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q162719 TITLE : HOWTO: Use the WebBrowser Control from Visual Basic 5 ARTICLE-ID: Q155969 TITLE : HOWTO: How to Distribute the WebBrowser Control |
Additional query words: PARAMETERS WEBBROWSER VBD
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |