110,533
社区成员
发帖
与我相关
我的任务
分享
private void button8_Click(object sender, EventArgs e)
{
if(textBox3.Text=="")
{
MessageBox.Show("请输入城市名字!");
}
else
{
string Xvalue=textBox3.Text;
UpdateConfig(Xvalue);
callWeatherService();
string str1="",str2="";
chosePictureBox(str1, str2) ;
showWeather();
}
}
private void UpdateConfig(string Xvalue)
{
XmlDocument doc = new XmlDocument();
doc.Load(Application.ExecutablePath+".config");
XmlNode node = doc.SelectSingleNode(@"//add[@name='chengshi']");
XmlElement ele = (XmlElement)node;
ele.SetAttribute("connectionString", Xvalue);
doc.Save(Application.ExecutablePath+".config");
}