Machsupport Forum

Mach Discussion => VB and the development of wizards => Topic started by: 10k on December 23, 2011, 09:51:58 AM

Title: User Defined Function
Post by: 10k on December 23, 2011, 09:51:58 AM
Is there a way to create user defined functions that are available globally?

In the screen designer, I have defined several buttons that execute VB code.  The functions are similar, but not identical.  I have a VB function that's defined in a large section of code.  I'd prefer not to include the code that defines the function in each of the calling buttons.  If I do, I have to keep editing every instance when I make a change.  What I'd like to do is:

     Button 1-10 - just a few lines of code that call function using different parameters.

     Large chunk of code defining function - located somewhere else.

I need to pass parameters to the function, and receive return parameters from the function.  The function needs to complete execution before returning control to the calling VB code.

Is there a way to do this?  I've searched the forum and so far it appears that you can't do this.

Thanks.

Title: Re: User Defined Function
Post by: ger21 on December 23, 2011, 10:08:25 AM
See #Expand on page 108
http://www.machsupport.com/docs/Mach3_V3.x_Macro_Prog_Ref.pdf