We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Variablentransfer within a class module and form

themroc
themroc asked
on
Medium Priority
165 Views
Last Modified: 2010-04-30
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?
Comment
Watch Question

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

Author

Commented:
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?

Author

Commented:
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

Author

Commented:
Dan Rollins, cause I answered the Question on my own I would like to ask for a refund
themroc
PAQed with points refunded (250)

Computer101
EE Admin

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.