I have several methods that I use in all of my forms and projects. I would like to place them in a library and access them from wherever I need them. Can you help me with the setup and syntax? I have done this in other languages I hope I can do it here as well.
I have several methods that I use in all of my forms and projects. I would like to place them in a library and access them from wherever I need them. Can you help me with the setup and syntax? I have done this in other languages I hope I can do it here as well.
If these are methods that simply act upon data that you pass to them then you can define then as static methods in a class in a separate project.
Then add this project as a reference to your other projects that require these methods.
Static methods are associated with the class itself so you do not create an instance of the class in order to access its static methods.
Example.
calling program:
method-id button1_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
set textBox1::Text to type mylibrary.sharedclass::sharedMethod
goback.
end method.
static method in referenced class
class-id mylibrary.sharedclass.
working-storage section.
method-id sharedMethod static.
procedure division returning mystring as string.
set mystring to "return from sharedMethod"
goback.
end method.
end class.
I have several methods that I use in all of my forms and projects. I would like to place them in a library and access them from wherever I need them. Can you help me with the setup and syntax? I have done this in other languages I hope I can do it here as well.
Just what I needed. Thanks.
I have several methods that I use in all of my forms and projects. I would like to place them in a library and access them from wherever I need them. Can you help me with the setup and syntax? I have done this in other languages I hope I can do it here as well.
Just what I needed. Thanks.
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.