HOWTO: Enable Communications Between UserDocuments/ UserControlsID: Q195087
|
This article covers how to enable communications between UserControls and UserDocuments and other programs. There are times when both UserControls and UserDocuments need to communicate with other forms that are part of the entire program. Making public functions and public subroutines only enables communications from parent forms and processes. Using GLOBAL instead of PUBLIC allows information to be shared between controls, classes, and forms.
The project code below is an example of Global Variables being shared:
Option Explicit
Global MyNumber As Variant
Private Sub UserDocument_Initialize()
Command2.Caption = ">>"
Label1.Caption = "Set the number below"
End Sub
Private Sub Command1_Click()
MyNumber = Text1.Text
End Sub
Private Sub Command2_Click()
UserDocument.Hyperlink.NavigateTo App.Path & "\UserDocument2.Vbd"
End Sub
Private Sub Command1_Click()
UserDocument.Hyperlink.GoBack
End Sub
Private Sub Command2_Click()
UserDocument.Hyperlink.NavigateTo App.Path & "\UserDocument3.vbd"
End Sub
Private Sub UserDocument_Initialize()
Command1.Caption = "<<"
Command2.Caption = ">>"
Label1.Caption = "The Magic Number Is"
Text1.Text = MyNumber
End Sub
Private Sub Command1_Click()
UserDocument.Hyperlink.GoBack
End Sub
Private Sub UserDocument_Initialize()
Command1.Caption = "<<"
Label1.Caption = "The Magic Number Is"
Text1.Text = MyNumber
End Sub
For more information about UserControls and UserDocuments, use VB Help and
query UserControls or UserDocuments.
(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by
Richard T. Edwards, Microsoft Corporation
Additional query words: kbDSupport Kbdse
Keywords : kbCtrl kbVBp kbVBp500 kbVBp600 kbCodeSam
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 18, 1999