Dear All..

I been working on XML for the past 2 weeks and am bit new to this concept..however i have put my effort to solve my problem..

I have suceeded in creating and appending a node to a XML file..But i have problem in Removing a node in a XML file..Please see my Code below and help me to Solve this problem..

XML file... = final.xml


Code to Remove Node..

Am using a button to remove the node..


Private Sub BnRemove_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BnStart.Click
dim Taskid1 as string
Taskid1 = "PS0002440"
Taskid1 = Taskid1.Trim
Call XmlRemove(Taskid1)
End Sub


Public Sub XmlRemove(ByVal TaskId As String)
Dim Tskid, Stats As String
Tskid = TaskId.ToString.Trim
Dim myDoc As Xml.XmlDocument = New Xml.XmlDocument
MsgBox("file loaded")
Dim myNode As XmlNode = myDoc.SelectSingleNode("TaskDetails\Task[Name='" & Tskid & "']")
MsgBox("Node Deleted")
Dim root As XmlNode = myDoc.DocumentElement()
MsgBox("Xml File Generated")
End Sub

Please Help me..i need to remove the parend node when i pass the taskid to the function..

Dear friends..

I have solved the Thread with slight modification in the XML file...

<?xml version="1.0" encoding="utf-8"?>
<Task Name="PS0001234">

Now i can delete the nodes sucessfull...

commented: Good Work And Persistance. +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.