//读取XML文件的方法
public string GetWebUrl()
{
string filepath = Application.StartupPath + "//Appinfo.xml"; //Application.StartupPath表示exe文件所在的位置。
bool exists = System.IO.File.Exists(filepath);
if (exists)
{
DataSet ds = new DataSet();
ds.ReadXml(filepath);
string strNumber = ds.Tables["webInfo"].Rows[0]["url"].ToString();
return strNumber;
}
else
{
return "No url!";
}
}
//创建XML文件的方法
XmlDocument zcdoc = new XmlDocument();
string filepath = Application.StartupPath + "//Appinfo.xml";
string xmlstr = "<regInfo><webUrl>" + txtWebAddress.Text.Trim() + "</webUrl></regInfo>";
zcdoc.LoadXml(xmlstr);
zcdoc.Save(filepath);