Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 150
  • Last Modified:

Variablentransfer within a class module and form

I have got a dll project which consists of a class module (cClass) and a form (formdll) (Modal)

In class Module I have got a public subroutine:

Public sub graph(x,y,z....)

This subroutine  does some basic calculations and populates an X;Y graph on the form.

I invoke this by Calling this subroutine from the server application
Call graph(X,Y,Z...)

As a result the graph is redrawn and everything works fine.
Now my Problem.
The form (formdll) needs to be modal and after I call the subroutine graph the focus is on this form.

In order to redraw the graph in a different scale I would like to use the variables (X,Y,Z...) again but they are out of scope by now.
So in essens I need to be able to recall the subroutine graph(X,Y,Z...) from the form with the same variables as from the server application.

One way would be to make all the different variables public wityhin the class module, but I would like to avoid this.

I hope the problem is understanable?
  • 3
  • 2
1 Solution
You can create a method rescale() on the class to which you just pass in a scaling factor rather than x, y, z. The rescale method uses (private) member variables x, y, z to plot the new dimensions.

But if you must have x, y, z values available to the form then you will need to do something like
define a method getDimensions() that returns an array of x, y, z (or define 3 methods getX(), getY() etc.).

- Ravs
themrocAuthor Commented:
the problem is that I can not access the variables again from the server application. So is there any way to keep the variales within the form or class module environment?
I don't get the problem - you have instantiated the class module the object is in scope within the server, isn't it? So why can't you just depend on the object to keep track of x, y, and z?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

themrocAuthor Commented:
The problem was that in my dll there is a class module and a form module.
Than variables were used in the class module and I needed to access the same variables from the form module.
The problem is that when I tried to acces the variables with MyClass.... there was no reference from the form to the class module. So as a result I set the reference with
Set Myclass = new class.
When I did this the variables were lost.

In the end I did the following which works now:
I created annother ordinary module within my dll project. Then I transfer the variables which I need to this module. Here they are dimensioned on a module level. With this methode I am able to access the variables from the form and it works.

But maybe you have an idea whether it is possible to retrive variables in a form within a dll from a class module?
Otherwise I close the Question.
themrocAuthor Commented:
Dan Rollins, cause I answered the Question on my own I would like to ask for a refund
PAQed with points refunded (250)

EE Admin

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now