Solved

VB.NET console app needs to share it's module level public variables

Posted on 2008-10-30
2
359 Views
Last Modified: 2012-05-05
I have a console application that creates several objects which are instantiated classes which are part of the solution.  How can I share a console level variable between other class/dlls without passing the value into the class via something like sub new (myValues as someSetOfSharedValues)?

0
Comment
Question by:Howard Bash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 22847987
making the variables public will do it..but I'd suggest "Friend" (it's like public but a bit more secure).  The other idea is to use a database as the middleman between the different objects (if it makes sence to do that).
0
 
LVL 18

Accepted Solution

by:
Priest04 earned 500 total points
ID: 22848483
You showed an example that you want to pass variables through constructor. Yes, you can do that, just make a class constructor that accepts these variables.

Other way would be to have variables shared (static in c#). This can be done either by creating a shared class, or by creating a module, and having public fields (variables) in it. This fields will be visible everywhere in application, so you don't need to pass them in constructor.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help with consolidating excel files using VB.net 2 35
Get month and date in a format 4 45
vb.net datagrid point 4 22
Set arraylist as datatable 2 8
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question