Is it possible for one form to call a function that resides on another form or do I need to create module with a Public function? I know this is fundamental, but I can't seem to find anything related to this.
Thanks.
Printable View
Is it possible for one form to call a function that resides on another form or do I need to create module with a Public function? I know this is fundamental, but I can't seem to find anything related to this.
Thanks.
if you make the function public in the form you can call from, say form1,
form2.myfunction
its possible...
say form1 wants to call a command button procedure on form 2
so it would be like this...
VB Code:
'command button on form 1 Public Sub Command1_Click Form2.Command2_Click 'Command button on form 2 that you want to call. End Sub
If you make the sub Public on your form, then it can be called from another form by explicitly referring to the form the sub is on.VB Code:
'example 'On form1 Public Sub DoSomething() 'cool code End Sub 'on Form2 Private Sub cmdDoSomething_Click() Form1.DoSomething End Sub