vb.net 读写xml方法(1)__教程 |
|
日期:2007-5-20 0:38:29 人气:90 [大 中 小] |
|
|
|
Dim domXmlDocument As System.Xml.XmlDocument Dim tmpPath As String = AppTempFilePath Dim xmlFile As String = tmpPath + "\testXml.xml"
’窗体加载事件 Private Sub TestXml_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ’读xml过程测试通过 Dim domXmlDocument As System.Xml.XmlDocument Dim tmpPath As String = AppTempFilePath Dim xmlFile As String = tmpPath + "\testXml.xml" Dim reader As System.Xml.XmlReader = Nothing Try reader = New Xml.XmlTextReader(xmlFile) ’reader. While reader.Read Me.lboxXml.Items.Add(reader.Name + reader.Value) End While Catch ex As Exception MsgBox(ex.Message) Finally If Not (reader Is Nothing) Then reader.Close() End If End Try End Sub ’载入xml事件 Private Sub btnXmlLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXmlLoad.Click ’Me.lboxXml.Items.Clear() ’’读xml过程测试通过 ’Dim reader As System.Xml.XmlReader = Nothing ’Try ’ reader = New Xml.XmlTextReader(xmlFile) |
|
出处:本站原创 作者:佚名 |
|
|