Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Administrators
Posted

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.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...