|
-
Dec 7th, 2002, 04:54 PM
#1
Main sub and UserControl
Is there any way to call a sub from UserControl from Main sub? Or do anything at all for the control? I tried UserControl.Sub_Name and UserControlsName.Sub_Name but with no luck...
I'd also know something more about using the Main sub in an OCX / ActiveX, just some general information would be nice 
And I did a search on the forums and found nothing about this matter.
-
Dec 7th, 2002, 08:01 PM
#2
-
Dec 7th, 2002, 08:32 PM
#3
I have the Main sub in the control (meaning, in a module), not the control on a form. I get a compile error when I try to do anything for the UserControl.
-
Dec 7th, 2002, 10:17 PM
#4
ParentForm.UserControlsName.Sub_Name
-
Dec 7th, 2002, 10:24 PM
#5
Have to make this clear: I'm making a control, not using one in a program.
-
Dec 7th, 2002, 10:43 PM
#6
I'm a little confused. Are we just talking any old sub in a module in your AX control project? If so, you'll need to make the sub in the module public, and also make a public "piggy back" sub in the usercontrol, so other projects can access it.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 7th, 2002, 10:49 PM
#7
What do you mean by "piggy back"? I made the sub I wanted to call Public - it just doesn't help as I can't access the UserControl from the module at all.
-
Dec 7th, 2002, 10:53 PM
#8
By piggy back I meant that The outside world would call the method in the usercontrol, and that in turn would simply pass all the arguments it gets to the method in the module. And likewise with the return value (if any).
As for accessing the usercontrol from the module, can't you just pass in a reference to the current instance? ie
VB Code:
'In module
Public Sub SayMyName(c As SomeUserControl)
MsgBox c.Name
End Sub
'In Usercontrol
Public Sub CallSayMyName()
SayMyName Me
End Sub
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Dec 7th, 2002, 11:06 PM
#9
Hmm, well I found a way to do the thing I wanted without using a Main sub to confuse my life. Then I found out the changes didn't help me at all: even by using API gettickcount to do animating on the UserControl, the animating stops if I ie. scroll something - before I used a timer. So...I'm stuck with the thing. I'd like to do animating but I must use DoEvents (which apparently is the one that causes animating to stop) or the control doesn't seem to work at all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|