Skip to main content

Hi,

I have a program consisting of 2 forms and several classes, i.e. customerclass, materialclass etc. These call an interop xfakt.dll which requires a new login for each new created instance.

What I need is to share one call with all forms and classes like:

01 xfakt.  type xfakt.app .

Method...

set xfakt to new xfakt.app()

I need to share this instance of xfakt with all other classes.

Thanks in advance.

Hi,

I have a program consisting of 2 forms and several classes, i.e. customerclass, materialclass etc. These call an interop xfakt.dll which requires a new login for each new created instance.

What I need is to share one call with all forms and classes like:

01 xfakt.  type xfakt.app .

Method...

set xfakt to new xfakt.app()

I need to share this instance of xfakt with all other classes.

Thanks in advance.

Hallo Karl

You can possibly define xfakt as a static property in a class. So you can invoke it by myclass.xfakt.

Freundliche Grüsse

Werner Lanter


Hi,

I have a program consisting of 2 forms and several classes, i.e. customerclass, materialclass etc. These call an interop xfakt.dll which requires a new login for each new created instance.

What I need is to share one call with all forms and classes like:

01 xfakt.  type xfakt.app .

Method...

set xfakt to new xfakt.app()

I need to share this instance of xfakt with all other classes.

Thanks in advance.

Not sure how the login requirement fits in but the usual approach is to implement the singleton pattern:

en.wikipedia.org/.../Singleton_pattern

Essentially, a class with a static method that maintains a single instance of an object. The class has a private constructor so all those that require the object must do so through the get_Instance method.


Hi,

I have a program consisting of 2 forms and several classes, i.e. customerclass, materialclass etc. These call an interop xfakt.dll which requires a new login for each new created instance.

What I need is to share one call with all forms and classes like:

01 xfakt.  type xfakt.app .

Method...

set xfakt to new xfakt.app()

I need to share this instance of xfakt with all other classes.

Thanks in advance.

I think this would be the way to do it. Do you have any cobol examples on how to build the singleton class and the calls to it from other classes?


Hi,

I have a program consisting of 2 forms and several classes, i.e. customerclass, materialclass etc. These call an interop xfakt.dll which requires a new login for each new created instance.

What I need is to share one call with all forms and classes like:

01 xfakt.  type xfakt.app .

Method...

set xfakt to new xfakt.app()

I need to share this instance of xfakt with all other classes.

Thanks in advance.

I am attaching an example that contains a WinForms project that has a form and a couple of additional  classes including one that contains the static method that will either create a new object if required or return the current one if it already exists. This object will then be accessed in both the form and another class to show that the object is indeed the same one.

Thanks.