can not access config file 
Author Message
 can not access config file

I believe I was able to get what you wanted by following these steps:

In the Project menu, select Add New Item...  Add a new "Application
Configuration File" item (it will be added as "App.config", but will
automatically get renamed to <Project Name>.exe.config and copied to the bin
directory when you build).

I changed the App.config file to look like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
 <add key="merch" value="shootme"/>
</appSettings>
</configuration>

I added this code:

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        Dim jane As String
        jane =
System.Configuration.ConfigurationSettings.AppSettings("merch")
        MsgBox(jane)
    End Sub

The messagebox showed "shootme".

I hope this helps,
Stephen
VB.NET Team
--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:
> need a sanity check.

> i've used config files before but i am not able to read from one that i
set
> up for a windows project.

> the project is called WindowsApplication1
> the config file is WindowsApplication1.exe.config

> the config file contains
> <configuration>
> <appSettings>
>     <add key="merch" value="shootme" />
> </appSettings>
> </configuration>

> within a button1_Click event i have the following

> dim jane as string
> jane=ConfigurationSettings.AppSettings("merch")
> MsgBox(jane)

> at the end jane is a zero length string. Whats happening? I've used config
> files for asp.net apps but its not working for me here.

> help



Mon, 31 Jan 2005 04:47:38 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. can not access config file

2. Cans access2.0 engine access btrieve files?

3. how to read from xml config ex: web.config

4. App.Config : a key does not exist in the appSettings

5. Application.config not read in dll's??

6. HELP: VB 6 works with Access97 file, not Access 2000 file

7. config file get deleted when I compile

8. several config files

9. Config File

10. .config file with smart client

11. reading web.config type file from windows service

12. CONFIG file rebuilt on every build

 

 
Powered by phpBB® Forum Software