home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Tool Box
/
SIMS_2.iso
/
vb_code1
/
dispatch
/
readme.txt
< prev
Wrap
Text File
|
1993-09-03
|
2KB
|
62 lines
This is the first attempt of a little dispatcher to invoke 'local' procedures of a
form from other modules/forms.
All procedures defined in a form are local to that form. So there's no chance to
load a form, invoke one or more procedures of the form and then to show it.
My problem was:
I build a form with data access to show the user some data to choose from.
The data shown in the form is dependent on other data stored somewhere in
other forms. I wanted to change the data recordsource and some other controls
while loading the form.
One way to do this is to set the controls via form1!control...
But then I have the same code on several places in my application.
Calling (the way I prefer) a form procedure doesn't work because all procedures
of a form are local to that form.
So I implemented my litte dispatcher.
The dispatcher is a textbox control array on the form I want to invoke procedures from.
The procedures are invoked in the change-event procedure of the textbox.
The name of the textbox array is 'dispatcher'
dispatcher(1) - dispatcher(n) must be set with the arguments of the procedure to call.
dispatcher(0) must be set with the name of the procedure as string.
Setting these values will cause a change-event in the dispatcher control.
But better you have a look at the forms and the code I included into the ZIP file.
The ZIP file includes:
form1.frm The form invoking procedures of form2
form2.frm The form which procedures are invoked
dispatch.bas Dispatcher source code
project1.mak The VB 3.0 Project
readme.txt This file
Maybe there's another (better) way to solve this task.
All comments are welcome and appreciated.
I can be reached at:
Oliver Mangold
Hagsbucherweg 20
89150 Laichingen
Germany
Tel. 49-7333-6007 Fax. 49-7333-21266
Or E-Mail at CompuServe 100277,511
Excuse me for my bad English. It isn't as good as it could be :-)
Oliver