Results 1 to 13 of 13

Thread: Configuration File in C#

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145

    Configuration File in C#

    Hi,

    In VB.Net projects, you can specify a configuration file where in you can define the connection string and other variables.

    I notice that in C#, there is no configuration file.

    What is the equivalent of a configuration file in C#? I wanted to declare my connection string externally so that even I change database connections, I dont have to compile the program again.

    Many thanks.

  2. #2
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Its the same thing in C#. Right click in the solution explorer click Add->Add New Item-> web.config

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145

    I don't have any

    Hi DevGrp,

    Why is that I don't have any web.config? I have Visual Studio 2002.

    Thanks.

  4. #4
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    Are you building a Web app or a Windows Form app? It should be app.config if you are building a Windows Forma app.
    Last edited by DevGrp; Sep 12th, 2003 at 12:30 AM.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145
    Hello,

    I'm building a windows apps. When I right click on the solution explorer->add new item, I can't see any template for Application Configuration File.

    What I did was I just type in app.config.

    Thanks DevGrp.

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Right click in the solution explorer click Add->Add New Item-> Application Configuration File (at the bottom) .

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145
    Hi Pirate,

    I can't see any application configuration file when adding new item. But in VB.Net Projects, its there. I wonder what's wrong?

  8. #8
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    On the left side of the box that pops up, there is a box with a plus sign click on it and you should get more stuff.

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Right click on the proj name (not the solution name) , then Add New Item then follow the above instruction .

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145

    It's really not there!

    Hi DevGrp and Pirate,

    I did all your instructions, but its really not there. This is only in C# projects, in VB projects, the application config file is existing. Anyway, I just typed in app.config and just copied my setting from my VB projects.

    Thanks Guys!

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Weird , What version are you on ?

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    145
    I have Visual Studio 2002

  13. #13
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Then I think it's not there . But I'm still sure it exists in VS.NET 2003 .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width