The value in the configuration file is obtained by using ConfigurationManager's appsettings["One of the field names to get" method.
<span style="font-size:24px;"> </span><span style="font-size:14px;">Private voidNormalform_load (Objectsender, EventArgs e) { stringWorkunitname = configurationmanager.appsettings["Workunitname"]. ToString (). Trim ();//Station Use stringProcedureName = configurationmanager.appsettings["procedurename"]. ToString (). Trim ();//OperationWorkunitno = configurationmanager.appsettings["Workunitno"]. ToString (). Trim ();//Station CodingProcedureno = configurationmanager.appsettings["Procedureno"]. ToString (). Trim ();//Operation CodeTosslaboperater.text ="Operator:"+Operatername; Tosslabstationno.text="Current unit of work:"+Workunitname; Tosslabcurrentprocedure.text="Current Operation:"+procedurename; Mshowchart (); //number of initial load station statisticsMshowconfig ();//Determine if the Configure button is displayed}</span>
You must refer to the System.Configuration namespace (DLL) when you use the ConfigurationManager object, or you will get an error that cannot be referenced. NET provides the System.Configuration.dll that the classes provided under this namespace can easily read and write these parameter configurations to an XML file.
How C # reads the config file