0% found this document useful (0 votes)
30 views2 pages

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

This code is adding student data from Form4 to labels on Form3 and adding a new student node to an XML admissions file. It retrieves the student name, date of birth, email, mobile number, course, and marks from Form4, displays them on labels, and then creates XML elements for each piece of data and adds them as child nodes to a new <student> node in the admissions XML file. It sets the student ID attribute to '*' and writes the updated XML file to disk.

Uploaded by

supriya028
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

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

This code is adding student data from Form4 to labels on Form3 and adding a new student node to an XML admissions file. It retrieves the student name, date of birth, email, mobile number, course, and marks from Form4, displays them on labels, and then creates XML elements for each piece of data and adds them as child nodes to a new <student> node in the admissions XML file. It sets the student ID attribute to '*' and writes the updated XML file to disk.

Uploaded by

supriya028
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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