Retain data value from form to module
I have a switch that is set to a value in a form subroutine.
I need to know how to transfer that switch value from the form subroutine to a module subroutine.
Web Development
I have a switch that is set to a value in a form subroutine.
I need to know how to transfer that switch value from the form subroutine to a module subroutine.
by john_wills
by hurdk
In a similar vein to the previous answer, you could set up a public variable in the module and reference that from the form subroutine. Don't forget that to reference a var in another form or module that you need to prefix it with the name of the form or module e.g. form.var
This type of solution pre-supposes that both the form and module are in existance at the same time. If not, you need to create some persistant data. Assuming you are in a single process type environment, i.e. there is only ever going to be one valid value for this switch at any one time, you could write the value out to a key in the registry from within the form and then read it in from within the module. The same holds true with the property bag, although I have never used the property bag in anything more than an experiment.
If you are in a multi-process evnivronment, I would be inclined to write the data out to a file which included the switch value itself, and some way of identifying the owning process.
No doubt other people have other views on this.
by hurdk
Excellent answer.
Thank you.
by hurdk
This discussion is closed to new replies.
Sort by Trending