Windows Form in Shared Add-in not reading App.config settings

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Good Morning,
I am developing an Outlook Shared Add-in using VB.Net. A Windows form has
been added to the project, but is not reading the values in the app.config
file during testing. The code (Sub Main) is below and displays "Blank
connection string" is the label. It is called by an Outlook command button
click event:

Private Sub btnCTXNotesHistory_Click(ByVal Ctrl As
Microsoft.Office.Core.CommandBarButton, ByRef CancelDefault As Boolean)
Handles btnCTXNotesHistory.Click
Dim frmNotesHistory As New frmCTXNotesHistory
frmNotesHistory.Main()
frmNotesHistory.Show()
End Sub

Sub Main()
Dim sqlconCTXControl As New SqlClient.SqlConnection
sqlconCTXControl.ConnectionString =
ConfigurationSettings.AppSettings("sqlconCTXControl.ConnectionString")
lblErrorMsg.Text = sqlconCTXControl.ConnectionString.ToString
If lblErrorMsg.Text.Length = 0 Then
lblErrorMsg.Text = "Blank connection string"
End If
End Sub

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top