?
Solved

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

Posted on 2008-10-30
2
Medium Priority
?
362 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 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month11 days, 3 hours left to enroll

770 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