using
System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Reflection;
using System.IO;
namespace DeviceApplication3
... {
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
public string GetIP()
...{
//得到应用程序当前路经
string a= Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
//XML DOM树
XmlDocument doc = new XmlDocument();
doc.Load(a+"/Set.xml");
XmlNodeList lst = doc.GetElementsByTagName("IP");
return lst[0].InnerText.Trim();
}
private void button1_Click(object sender, EventArgs e)
...{
this.label1.Text= GetIP().Trim();
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using System.Reflection;
using System.IO;
namespace DeviceApplication3
... {
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
public string GetIP()
...{
//得到应用程序当前路经
string a= Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);
//XML DOM树
XmlDocument doc = new XmlDocument();
doc.Load(a+"/Set.xml");
XmlNodeList lst = doc.GetElementsByTagName("IP");
return lst[0].InnerText.Trim();
}
private void button1_Click(object sender, EventArgs e)
...{
this.label1.Text= GetIP().Trim();
}
}
}