I have row value in datagridview, I want to write some value in xml but I cant execute the for loop inside xml
Public Sub WriteXML()
Dim uTime As Double
uTime = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds
Dim formattedValue As Double = CDbl(uTime)
uTime = formattedValue.ToString("N3").Replace(".", "")
Dim document As XDocument = <?xml version="1.0" encoding="UTF-8"?>
<XmlStatus name=<%= uTime %>>
<versionInfo>
<Parameters name="Param">
<list>
<%= For i = 0 To Form1.DataGridView1.RowCount - 1
<mydate uniqueId=<%= uTime %>>
<Parameter name="common">
<Param name="Name" value="test1"/>
</Parameter>
</mydate>
Next %>
</list>
</Parameters>
</versionInfo>
</XmlStatus>
I tried it another way
Public Function SlicesWriter()
Dim test As String
For i = 0 To Form1.DataGridView1.RowCount - 1
If Not (Form1.DataGridView1.Rows(i).Cells(2).Value.ToString = 0) Then
test = "<mydate uniqueId=" & uTime & ">"
test = "<Parameter name=common>"
End If
Next
Return test
End Function
the problem with that function is I cannot scape the <> when the xml file was save the value on that line is
<mydate uniqueId=1748079638388>
thanks in advance!