<<(ByRef ctrl As MyControl)>>
But what do I pass for this parameter? I tried MyControl, but I get a "ByRef arguement type mismatch.
I also tried (in the .bas module):
Dim uCtrl As MyControl
But then recalled that I need to set it to something. So I tried to add:
Set uCtrl = MyControl
Didn't work.
If I am understanding correctly, I need an object in the .bas module that references the usercontrol, correct? I'm guessing I'm right, but how do I set up this object?
Main Topics
Browse All Topics





by: BeauTPosted on 2000-08-18 at 13:41:53ID: 3986035
1.) The friend function is still accessible, however, the question is whether you are making the correct object reference. If your UserControl is named MyControl, then following code, when placed in a .bas module int he same project will NOT work:
---------- ----
Public Sub DoSomething()
'TestFunction is a string returning Friend function in the UserControl.
MsgBox MyControl.TestFunction
End Sub
But, if you pass or declare a reference to the UserControl in the .bas module function, it will work, like this:
Public Sub DoSomething(ByRef ctrl As MyControl)
'TestFunction is a string returning Friend function in MyControl.
MsgBox ctrl.TestFunction
End Sub
You *could* also declare a new instance of MyControl and call it's friend function, but you would most likely not want to have multiple instances of a UserControl open for one UserControl project.
--------------------------
2.) I already touched on this a little, but the .bas module can have a routine which references the UserControl or one of it's constituent controls (controls placed on it). As in the example code above, you need to make sure to pass a reference to the UserControl or constituent control you want to interact with.
I hope this helps you out.