*** This is the first form i called it Form1?******
*************** *************** *************** *************
[CODE=vbnet]Imports System.Xml
Imports System.IO
Public Class Form1
Inherits System.Windows. Forms.Form
Private Sub btnFile_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles lodbtn.Click
Dim ofd As OpenFileDialog = New OpenFileDialog
Dim result As DialogResult = ofd.ShowDialog( )
If result = DialogResult.Ca ncel Then
Return
End If
Dim document As XmlDocument = New XmlDocument
document.Load(o fd.FileName)
Dim reader As XmlNodeReader = New XmlNodeReader(d ocument)
MsgBox("The File is loaded successfully!")
lblLoad.Text = (System.IO.Path .GetFullPath(of d.FileName))
Disbtn.Enabled = True
End Sub
Private Sub Displaybtn_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Disbtn.Click
Dim f As CourseDisplay
f = New CourseDisplay
f.Show()
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
End Sub[/CODE]
********* This is the second form i called it CourseDisplay.v b***********
*************** *************** *************** *************** *************** ******
[code=vbnet]
Imports System.Xml
Imports System.IO
Public Class CourseDisplay
Inherits System.Windows. Forms.Form
Private Sub Display_Load(By Val sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim document As XmlDocument = New XmlDocument
document.Load(" CP2830.xml")
Dim reader As XmlNodeReader = New XmlNodeReader(d ocument)
While reader.Read()
If reader.Name = "courseID" Then
Label1.Text = reader.ReadElem entString()
End If
If reader.Name = "courseName " Then
Label2.Text = reader.ReadElem entString()
End If
End While
For i = 0 To Student.GetUppe rBound(0)
sum += Convert.ToInt32 (Student(i))
Next
Label4.Text = studnetcount
End Sub
Private Sub clobtn_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles clobtn.Click
Me.Close()
End Sub
End Class
[/code]
that what i did
*********** the problem is how can i leave it to read the studnent
or how i can do this ( that i have to do it )
tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags
if tag is "courseID"
read contents and display on form
END IF
if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance
we are now on studnetName
read contents of tag , add to tempStr, advance
we are now on porgram
read contents of tag , add to tempStr, advance
Display tempStr on form
Add 1 to studnentCount
*************** *************** *************** *************
[CODE=vbnet]Imports System.Xml
Imports System.IO
Public Class Form1
Inherits System.Windows. Forms.Form
Private Sub btnFile_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles lodbtn.Click
Dim ofd As OpenFileDialog = New OpenFileDialog
Dim result As DialogResult = ofd.ShowDialog( )
If result = DialogResult.Ca ncel Then
Return
End If
Dim document As XmlDocument = New XmlDocument
document.Load(o fd.FileName)
Dim reader As XmlNodeReader = New XmlNodeReader(d ocument)
MsgBox("The File is loaded successfully!")
lblLoad.Text = (System.IO.Path .GetFullPath(of d.FileName))
Disbtn.Enabled = True
End Sub
Private Sub Displaybtn_Clic k(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles Disbtn.Click
Dim f As CourseDisplay
f = New CourseDisplay
f.Show()
End Sub
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
End Sub[/CODE]
********* This is the second form i called it CourseDisplay.v b***********
*************** *************** *************** *************** *************** ******
[code=vbnet]
Imports System.Xml
Imports System.IO
Public Class CourseDisplay
Inherits System.Windows. Forms.Form
Private Sub Display_Load(By Val sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
Dim document As XmlDocument = New XmlDocument
document.Load(" CP2830.xml")
Dim reader As XmlNodeReader = New XmlNodeReader(d ocument)
While reader.Read()
If reader.Name = "courseID" Then
Label1.Text = reader.ReadElem entString()
End If
If reader.Name = "courseName " Then
Label2.Text = reader.ReadElem entString()
End If
End While
For i = 0 To Student.GetUppe rBound(0)
sum += Convert.ToInt32 (Student(i))
Next
Label4.Text = studnetcount
End Sub
Private Sub clobtn_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles clobtn.Click
Me.Close()
End Sub
End Class
[/code]
that what i did
*********** the problem is how can i leave it to read the studnent
or how i can do this ( that i have to do it )
tempStr is a stirng variable
studentCount is an integer variable
studentCount =0
WHILE there are more tags
if tag is "courseID"
read contents and display on form
END IF
if tag is " courseName"
read contents and display on form
END IF
if tag is "studnet"
tempStr = " "
Skip to next tag
we are now on studnetID
read contents of tag , add to tempStr, advance
we are now on studnetName
read contents of tag , add to tempStr, advance
we are now on porgram
read contents of tag , add to tempStr, advance
Display tempStr on form
Add 1 to studnentCount
Comment