I have a program that I want the user to be able to set the online SQL Server Express connection and the local SQL Server CE file location on the first time it is run before the program tries to connect to either database. I have tried the following on the application events before startup but get denied permission:
Protected Overrides Function OnInitialize(commandLineArgs As ObjectModel.ReadOnlyCollection(Of String)) As Boolean
' My.Settings.FirstUse = True 'comment out after testing.
If My.Settings.FirstUse = True Then
Dim dlgFirstUse As New dlgFirstUse
If dlgFirstUse.ShowDialog = Windows.Forms.DialogResult.OK Then
My.Settings.FirstUse = False
The First Use dialog sets and tests the two connections. I have also tried doing it during main form load but the connections are already attempted or made by then. What I do in dlgFirstUse is modify the app.config file for the server connection string and set the |DataDirectory| for the client connection string.
Well, I need a better way and would appreciate suggestions.