Easy! Add a Setting in the VS designer:
1) Open the Solution Explorer pane, and open your project branch.
2) Open the Properties sub-branch, and double click "Settings.settings"
3) In the page that opens, create a new setting value: Name = strConnect, Type = string, Scope = User, Value leave blank.
4) Save and close the settings.
Now, add code:
1) In your main form Constructor, add this code:
string strConnect = Properties.Settings.Default.strConnect;
if (string.IsNullOrWhiteSpace(strConnect))
{
frmGetConnectionString f = new frmGetConnectionString();
if (f.ShowDialog() == DialogResult.OK)
{
strConnect = f.ConnectionString;
Properties.Settings.Default.strConnect = strConnect;
Properties.Settings.Default.Save();
}
else
{
Application.Exit();
}
}
Now all you have to do is create the form to get the connection string.