Problem reading app.config file
Posted on 2006-11-16
I have a user control that started by retrieving connection entry from a registry entry. I created a form that uses the version of the control that read the connection from the registry. I then changed the control to read the connection setting from an app.config file. The application seemed fine.
Now when I try to create a new form using the user control by dragging and droping the usercontrol from the toolbox, I'm getting a msgbox with an error saying Error retrieving connection string from configuration file in BaseDAL.vb file and the control is not added to the form.
After putting in countless msgboxes I found where the problem is happening.......
Dim strConnectionString As String
strConnectionString = ConfigurationSettings.AppSettings("ConnectionString")
If strConnectionString <> "" Then
m_sConnekStrg = strConnectionString
Throw New Exception("Error retrieving connection string from configuration file in BaseDAL.vb file.")
The messagebox displays with blanks which tells me the app file is not being read correctly
I can see the control appear in the form. when I click ok, the control disappears from the form and the
Error retrieving connection string from configuration file in BaseDAL.vb file appears.
Not sure why this is happening....
App file is read fine in the form containing the control before I made the change from reading from registry. Doesn't if I try to put updated control on a new form.