Global Data

G

Guest

What is the best way to handle global application data in a windows forms?
How about a VB module?
 
B

Brendon Bezuidenhout

Arne,

Personally I don't like modules - can't think off hand why but it does bring
back cold sweats and shivers from pre OO days :p

There is a resources secion of the project where you can store all the
global application now and be accessed with My.Application if you are using
VB (c# there is another way to access it as there is no My namespace in c#).
Click show all files in your project and you will see it... Or you can have
a look at:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=45 or
http://msdn2.microsoft.com/en-us/library/k4s6c3a0.aspx

HTH
Brendon
 
G

Guest

I found out how to set an application setting, but can't retrieve a setting.
How do I retrieve a setting?
csharpfriend doesn not respond.
--
Arne Garvander
Certified Geek
Professional Data Dude


Brendon Bezuidenhout said:
Arne,

Personally I don't like modules - can't think off hand why but it does bring
back cold sweats and shivers from pre OO days :p

There is a resources secion of the project where you can store all the
global application now and be accessed with My.Application if you are using
VB (c# there is another way to access it as there is no My namespace in c#).
Click show all files in your project and you will see it... Or you can have
a look at:
http://www.csharpfriends.com/Articles/getArticle.aspx?articleID=45 or
http://msdn2.microsoft.com/en-us/library/k4s6c3a0.aspx

HTH
Brendon
 
B

Bob Powell [MVP]

Global is kind of a dirty word in object oriented programming.

You should use a singleton pattern if you want the simplest solution. If
your application is likely to be large or complex I strongly recommend CAB
and the creation of a service that can be manages using the dependency
injection system it provides.

The dirty method, if you're really _really_ lazy and wish to be ridiculed by
all who know you, is a static class with static fields.

--
--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Global Variable 2
Global Exception Handling 2
Listening to an event 1
Global Variables 2
Form Load Events 2
global variable 3
Accessing a global variable on Multiple forms 2
Global error handling 1

Top