dhj Posted July 29, 2004 Posted July 29, 2004 hi i have a 3 tier windows aplication(VB.NET), and in my WINUI i have couple of shared variable. i need to read those shared variables from my BLL and DAL how am i suppose to access those shared variables from BLL and DAL Thank you Quote
mocella Posted July 29, 2004 Posted July 29, 2004 You can define a 4th project that has these shared variables defined within, reference this project from the other three, and have your UI create the initial instance of this 4th project, and let it live in your main form. When you instantiate/call your BLL or DAL, pass the instance of the 4th project (by-reference) and these other layers can now use the shared variables. There's other ways of doing this, this is just the first/easiest way that came to mind at 6:45am. ;) Quote
krinpit Posted July 30, 2004 Posted July 30, 2004 I guess a kind of an extension/variation of mocella's answer would be to * Define a 4th layer called WorkFlowLayer (WFL) or something * Ensure that all the other layers are dependant on the WFL * In the WFL, define a module (not a class) called modGlobalVars. * Define the variables you will use in modGlobal Vars - eg: Public System_Mode As String The beauty of defining modGlobalVars as a module rather than a class in this scenario is that it doesn't have to be instantiated before it's used. Quote
Administrators PlausiblyDamp Posted July 30, 2004 Administrators Posted July 30, 2004 What kind of information does the shared variables contain - depending on their contents it may be easier to just pass this information between the application layers rather than relying on global variables which can often lead to hard to maintain code. Also rather than using a module (which is only available in VB) use a class but declare the variables as shared - then you don't need to instantiate the class to access them. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.