Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2003, 03:21 PM
Authorized User
 
Join Date: Jul 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to p_nut33 Send a message via MSN to p_nut33
Default 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.


 
Old December 30th, 2003, 10:59 AM
Authorized User
 
Join Date: Jul 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to p_nut33 Send a message via MSN to p_nut33
Default

Nevermind,

Im not using shared anymore...Figured out that its just a way to share processes without instantiating an object. Now whenever I open a new form, I pass a reference to the calling form. Then I instantiate a new object of the same type as the caller form and assign it to the calling form reference. This works perfectly. Im not using shared and I can access everything.

Hope this might help somebody else in the future.






Similar Threads
Thread Thread Starter Forum Replies Last Post
standalone declaration Jay Frank XML 5 September 28th, 2007 08:57 AM
xml declaration chroniclemaster1 XML 0 September 20th, 2007 02:00 PM
Declaration for DuplicateTokenEx BrianWren Pro VB 6 0 April 6th, 2007 03:54 PM
Declaration Expected kenn_rosie ADO.NET 7 January 17th, 2006 03:58 AM
Declaration Difference anubhav.kumar Pro VB.NET 2002/2003 2 July 5th, 2005 10:19 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.