-1

I used Settings.settings interface in VS2022 to add some user settings and a connection string. But I am unable to read the App Settings.

Reading the connection string works using

string sDBConn = System.Configuration.ConfigurationManager.ConnectionStrings["MissingSamplesGUI.Properties.Settings.DBConn"].ConnectionString;

However, I cannot read the User Settings from the same App.Config file. Using

int iFormTop = (int)System.Configuration.ConfigurationManager["FormTop"];


Does not work. How do I read and write these settings?

Lee
  • 25
  • 4
  • Your question is not clear to me. It may help you look at: https://stackoverflow.com/questions/1189364/reading-settings-from-app-config-or-web-config-in-net or https://learn.microsoft.com/en-us/visualstudio/data-tools/how-to-save-and-edit-connection-strings?view=vs-2022 – NoChance Oct 27 '22 at 22:54

1 Answers1

-1

It's done as follows.

Properties.Settings.Default.FormTop;
Lee
  • 25
  • 4