111,125
社区成员
发帖
与我相关
我的任务
分享
老板说要我加个app.config文件可以修改,但是我不能把webBrowser和app.config文件关联起来啊。。。
还有在代码界面里打webBrowser1.Url = new Uri()虽然可以打开网页但是网页会不停的闪烁,打不开下一个网页了,但在属性里设置webBrowser的Url属性都没有闪烁的。。。
跪求大神解答!!!
private string ReadSetting(string strName, string strDefault)
{
string strReturn = strDefault;
string applicationName = Environment.GetCommandLineArgs()[0];
string exePath = System.IO.Path.Combine(Environment.CurrentDirectory, applicationName);
Configuration cfAll = ConfigurationManager.OpenExeConfiguration(exePath);
if (cfAll.AppSettings.Settings[strName] != null)
{
strReturn = cfAll.AppSettings.Settings[strName].Value;
}
return strReturn;
}
//或者直接用获取
System.Configuration.ConfigurationManager.AppSettings[key]