日期:2012-12-22 浏览次数:20431 次
简单的一个应用例子 ,只是简单的操作XML文件,在实际的应用上可以先建一个配置类保存状态。
XML文件的结构:
1 <?xml version="1.0" encoding="utf-8" ?>
2 <config>
3 <Function Name="a" Checked="false" />
4 <Function Name="b" Checked="false" />
5 <Function Name="c" Checked="false" />
6 <Function Name="d" Checked="false" />
7 </config>
具体的程序:需要一个CheckedListBox,两个Button
1 Public doc As New XmlDocument
2 Public rootnode As XmlElement
3 Public strPathConfig As String = Application.StartupPath & "\config.xml"
4 Public intNum As Int16
5 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
6 WriteConfig()
7 End Sub
8 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
9 &n