Advertisement
Guest User

Visual Basic Tutorial (Youtube)

a guest
Jan 20th, 2011
8,403
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.61 KB | None | 0 0
  1. Add to very top of form:
  2.  
  3. Imports System.IO
  4. Imports System.Xml
  5.  
  6. Add inside load XML button:
  7.  
  8.         If (ComboBox1.Text = "") Then
  9.  
  10.             MessageBox.Show("No file name entered")
  11.  
  12.         Else
  13.  
  14.             If (System.IO.File.Exists(ComboBox1.Text.ToString())) Then
  15.  
  16.                 Dim document As XmlReader = New XmlTextReader(ComboBox1.Text.ToString())
  17.  
  18.                 While (document.Read())
  19.  
  20.                     Dim type = document.NodeType
  21.  
  22.                     If (type = XmlNodeType.Element) Then
  23.  
  24.                         If (document.Name = "Name") Then
  25.  
  26.                             xmlMyName.Visible = True
  27.                             xmlMyName.Text = document.ReadInnerXml.ToString()
  28.  
  29.                         End If
  30.  
  31.                         If (document.Name = "Email") Then
  32.  
  33.                             xmlMyEmail.Visible = True
  34.                             xmlMyEmail.Text = document.ReadInnerXml.ToString()
  35.  
  36.                         End If
  37.  
  38.                         If (document.Name = "Tel") Then
  39.  
  40.                             xmlMyTel.Visible = True
  41.                             xmlMyTel.Text = document.ReadInnerXml.ToString()
  42.  
  43.                         End If
  44.  
  45.                         If (document.Name = "Notes") Then
  46.  
  47.                             xmlMyNotes.Visible = True
  48.                             xmlMyNotes.Text = document.ReadInnerXml.ToString()
  49.  
  50.                         End If
  51.  
  52.                     End If
  53.  
  54.                 End While
  55.  
  56.             Else
  57.  
  58.                 MessageBox.Show("The filename you selected was not found.")
  59.  
  60.             End If
  61.  
  62.         End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement