Hi there.. i've been cracking my head... its for my assignment.. the lecturer's crazy man.. giving us a task that she never even taught us at class..
anyway i really hope the sifus out there can help me to debug... it...
here are the codes
(the nearest one that managed to program)
Code:
Imports System.Xml
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Initialize the controls and the form.
Label1.Text = "File Path"
Label1.SetBounds(8, 8, 50, 20)
TextBox1.Text = "......\My Received Files\xml1.xml"
TextBox1.SetBounds(64, 8, 256, 20)
Button1.Text = "Populate the TreeView with XML"
Button1.SetBounds(8, 40, 200, 20)
Me.Text = "TreeView control from XML"
Me.Width = 336
Me.Height = 368
TreeView1.SetBounds(8, 72, 312, 264)
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tNode As TreeNode
Try
Dim reader As XmlTextReader = New XmlTextReader(".....\My Received Files\xml1.xml")
reader.WhitespaceHandling = WhitespaceHandling.Significant
TreeView1.Nodes.Clear()
Dim i, n As Integer
n = 0
While reader.Read()
TreeView1.Nodes.Add(New TreeNode(reader.Name))
If reader.IsStartElement Then
tNode = TreeView1.Nodes(0)
tNode.Nodes.Add(New TreeNode(reader.Name))
End If
If reader.HasAttributes Then
tNode = TreeView1.Nodes(n)
For i = 0 To reader.AttributeCount - 1
tNode.Nodes.Add(New TreeNode(reader.GetAttribute(i)))
Next
End If
n += 1
End While
TreeView1.ExpandAll()
Catch xmlEx As XmlException
MessageBox.Show(xmlEx.Message)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
End Class
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.