Help a web developer learn a few windows forms basics.....

Superfly1611

Regular
Joined
Feb 17, 2004
Messages
66
Location
UK
Hey all,

I'm trying to develop a fairly simple windows form application and i'm having a few problems (stemming from the fact that i've go no idea what i'm doing as i'm a web developer).

1 I create a new folder inside my project in Visual Studio and put files (such as an Access Database or config files) inside this folder. But when I build this project the newly compiled exe in the new directory doesn't automatically copy these files accross.

Now I can obviously do it manually but I find it hard to believe there isn't a way to get visual studio to do this for you at compile time?

2 Where do I store variables (such as data connection strings) so that they can be accessed from absolutely anywhere in the application?
It's easy in web apps because you store it in application state. I know I could do things like storing in the registry etc but thats overkill for what I want.
A few years back when I played with VB6 I used to store such variables in a module.

Many Thanks
 
If you select the mdb file in the Solution Explorer you should be able to set its Build Action to Content from the properties window. It should now be copied to the output directory.
Easiest way of storing application settings is to add an app.config file to your project - this works similar to a web.config in terms of how you store / access values.
 
I knew visual studio would let me do it somehow!

I'll look up a reference for App.Config, seems easy enough.

Thanks for your help.
 
Back
Top