Link to home
Start Free TrialLog in
Avatar of themroc
themroc

asked on

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?
Avatar of ravs120499
ravs120499

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.).

HTH
- Ravs
Avatar of themroc

ASKER

ravs,
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?
Avatar of themroc

ASKER

Ravs:
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.
Thanks
Themroc
Avatar of themroc

ASKER

Dan Rollins, cause I answered the Question on my own I would like to ask for a refund
themroc
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial