VB.NET using XML data, Deleting a row from XML

Posted by Farshadak2004 under VB.NET on 4/15/2012 | Points: 10 | Views : 1569 | Status : [Member] | Replies : 0
Hi
I am using XML document to Retrieve, Save and delete my data into a DataGridView table. But I don't know how can I delete the data. here is my code for adding and saving the data, user can select a row which contain this data from table in my application GUI. So for deleting, I want user to select the row and click the Delete button to delete the data. but I don't know what is the command for deleting. :

Dim Testcode = <TESTCODE>HIS_RESULT_CODE
<MACHINE_PANEL><%= txtMachineCode.Text.Trim %></MACHINE_PANEL>
<MACHINE_RESULT><%= txtMachineResult.Text.Trim %></MACHINE_RESULT>
<HIS_TEST_CODE><%= txtHISTestCode.Text.Trim %></HIS_TEST_CODE>
<HIS_RESULT_CODE><%= txtHISResultCode.Text.Trim %></HIS_RESULT_CODE>
<HIS_TEST_DESC><%= txtHISTestDesc.Text.Trim %></HIS_TEST_DESC>



<ACTIVE><%= cmbActive.Text.Trim %></ACTIVE>
<TimeStamp><%= Now.ToString("dd MMMM yyyy") %></TimeStamp>
</TESTCODE>

xmlTestCode.<COULTERDXI>(0).Add(Testcode)


Dim ql As XElement = (From ls In xmlTestCode.<COULTERDXI>.<TESTCODE> _
Where (CType(ls.Element("MACHINE_PANEL"), String) = txtMachineCode.Text.Trim) _
Select ls.Element("MACHINE_RESULT")).FirstOrDefault
ql.SetValue(txtMachineResult.Text.Trim)
xmlTestCode.Save("XML\TESTCODES.xml"




Responses

(No response found.)

Login to post response