Form3 Eventargs Form4 Form4 Form4 Form4 Form4 Form4 Form4 Form4 Form4 Form4 Form4 Form4

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Imports System.

Xml
Public Class Form3
Private Sub Form3_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Label1.Text += " " & Form4.sname
Label3.Text += " " & Form4.dob
Label4.Text += " " & Form4.email
Label5.Text += " " & Form4.mob
Label6.Text += " " & Form4.course
Label7.Text += " " & Form4.marks & " %"
addNode(Form4.sname, Form4.dob.ToShortDateString,
Form4.email, Form4.mob, Form4.course, CStr(Form4.marks))

End Sub
Public Sub addNode(sname As String, dob As String, email
As String, mob As String, course As String, marks As String)
Try
Dim xd As XmlDocument = New XmlDocument()
xd.Load("addmisions.xml")
Dim newstudent As XmlElement =
xd.CreateElement("student")
newstudent.SetAttribute("stu_id", "*")
Dim sn As XmlElement =
xd.CreateElement("Student_name")
sn.InnerText = sname
newstudent.AppendChild(sn)
Dim d As XmlElement =
xd.CreateElement("Date_Of_Birth")
d.InnerText = dob
newstudent.AppendChild(d)
Dim em As XmlElement = xd.CreateElement("Email")
em.InnerText = email
newstudent.AppendChild(em)
Dim mo As XmlElement =
xd.CreateElement("Contact_No")
mo.InnerText = mob
newstudent.AppendChild(mo)
Dim co As XmlElement =
xd.CreateElement("Course")
co.InnerText = course
newstudent.AppendChild(co)
Dim ma As XmlElement = xd.CreateElement("Marks")
ma.InnerText = marks
newstudent.AppendChild(ma)
xd.DocumentElement.AppendChild(newstudent)
Dim tr As XmlTextWriter = New
XmlTextWriter("addmisions.xml", Nothing)
tr.Formatting = Formatting.Indented
xd.WriteContentTo(tr)
tr.Close()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information)
End Try
End Sub
End Class

You might also like