Having Problems Using "Shared" Declaration
Im having Several problems with the "Shared" declared objects.
Im trying to get forms to communicate with each other. For example:
- There is a Main Form
- There is a Log-On form
So the load sequence is as follows.
1) Main Loads (Main also contains a shared Object called Coordinator which is remote (.Net Remoting)and returns data.
2) Upon "Form.Activate" it instantiates a Log-On form, but only the first time it runs.
3) Using Coordinator, the log on form serves to validate the user/password combination.
4) If succesfull, the log initiates a process in the Main form to load data and closes.
5) Main form loads all relevant data into the application.
Ok, problems I am having:
1) Even from within the main form, Coordinator cant be used on procedures and functions because it is shared. Shared procedures dont have access to "Me.whatever" or non shared members like textboxes.
2) In order to have access to the procedure which initializes the application from the log in form I had to use a Shared procedure. Problem is, from within the shared procedure I cant call other class procedures or objects unless they are shared too.
In the end using "Shared" resolves problems amongst inter form communication but messes up everything from within my Main form.
Why coulnd'nt Microsoft keep it simple, public is public private is private. Public Methods should be accesible to all project modules...but they aren't. What im I not getting right here, clearly there must be a way to solve this.
|