1. Add a Windows Form.
2. Drag one TextBox For Entering Name(txtName)
3. Drag one DateTimePicker For Selecting Date of Birth.(dtpBirthDate)
4. Drag a Button(btnCreateXML)
5.Dim XMLPath As String ="F:\XML Files\BirthDay.xml"
6. Create a Method Called (createNode)
Private Sub createNode(ByVal Name As String, ByVal BirthDay As String, ByVal writer As XmlTextWriter)
writer.WriteStartElement("BirthDayDetails")
writer.WriteStartElement("Name")
writer.WriteString(Name)
writer.WriteEndElement()
writer.WriteStartElement("BirthDay")
writer.WriteString(BirthDay)
writer.WriteEndElement()
End Sub
7. Under btnCreateXML Click write this Code.
If txtName.Text = "" Then
MessageBox.Show("Please Enter Name", "BIRTH DAY", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim writer As New XmlTextWriter(XMLPath, System.Text.Encoding.UTF8)
writer.WriteStartDocument(True)
writer.Formatting = Formatting.Indented
writer.Indentation = 2
writer.WriteStartElement("BirthDays")
createNode(txtName.Text, dtpBirthDate.Text, writer)
'createNode(2, "Product 2", "2000", writer)
'createNode(3, "Product 3", "3000", writer)
'createNode(4, "Product 4", "4000", writer)
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Close()
End If
with Regards
santosh
any error send request to santosh.mca08@gmail.com
2. Drag one TextBox For Entering Name(txtName)
3. Drag one DateTimePicker For Selecting Date of Birth.(dtpBirthDate)
4. Drag a Button(btnCreateXML)
5.Dim XMLPath As String ="F:\XML Files\BirthDay.xml"
6. Create a Method Called (createNode)
Private Sub createNode(ByVal Name As String, ByVal BirthDay As String, ByVal writer As XmlTextWriter)
writer.WriteStartElement("BirthDayDetails")
writer.WriteStartElement("Name")
writer.WriteString(Name)
writer.WriteEndElement()
writer.WriteStartElement("BirthDay")
writer.WriteString(BirthDay)
writer.WriteEndElement()
End Sub
7. Under btnCreateXML Click write this Code.
If txtName.Text = "" Then
MessageBox.Show("Please Enter Name", "BIRTH DAY", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim writer As New XmlTextWriter(XMLPath, System.Text.Encoding.UTF8)
writer.WriteStartDocument(True)
writer.Formatting = Formatting.Indented
writer.Indentation = 2
writer.WriteStartElement("BirthDays")
createNode(txtName.Text, dtpBirthDate.Text, writer)
'createNode(2, "Product 2", "2000", writer)
'createNode(3, "Product 3", "3000", writer)
'createNode(4, "Product 4", "4000", writer)
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Close()
End If
with Regards
santosh
any error send request to santosh.mca08@gmail.com
No comments:
Post a Comment