Editing xml file

  • Thread starter Thread starter dianas28
  • Start date Start date
D

dianas28

Guest
Good afternoon, my question is the following: I am loading the data in the text boxes from a data grid view, which allows me to select the row first, after selecting I have to edit. The problem I have is what you are adding and do not edit the one specified by the datagridview. Could you tell me where my error is or how to solve it please. What I need is to edit the one that was selected in the datagridview. But it is not edited.


Try

If booleanBanderaUno And booleanBanderaDos = True Then
btnGuardar.Enabled = True

Dim opciones As DialogResult

opciones = MessageBox.Show("¿Desea guardar la factura?", "factura", MessageBoxButtons.YesNoCancel)

If opciones = Windows.Forms.DialogResult.Yes Then

MessageBox.Show("Se ha guardado el archivo correctamente.")


If IO.File.Exists("Facturas.xml") Then

xmldDoc.Load("Facturas.xml")

Dim nodoContenedor As XmlNode = xmldDoc.CreateElement("Factura")

'Cedula Juridica
Dim subNodoCedula As XmlNode = xmldDoc.CreateElement("CedulaJuridica")
subNodoCedula.InnerText = txtCedulaJuridica.Text
nodoContenedor.AppendChild(subNodoCedula)

'Razon Social
Dim subNodoRazonSocial As XmlNode = xmldDoc.CreateElement("RazonSocial")
subNodoRazonSocial.InnerText = txtRazonSocial.Text
nodoContenedor.AppendChild(subNodoRazonSocial)

'Direccion
Dim subNodoDireccion As XmlNode = xmldDoc.CreateElement("Direccion")
subNodoDireccion.InnerText = txtDireccion.Text
nodoContenedor.AppendChild(subNodoDireccion)

xmldDoc.DocumentElement.AppendChild(nodoContenedor)
xmldDoc.Save("Facturas.xml")


Else

xmldDoc.SelectSingleNode("CedulaJuridica").InnerText = txtCedulaJuridica.Text
xmldDoc.SelectSingleNode("RazonSocial").InnerText = txtRazonSocial.Text

xmldDoc.Save("Facturas.xml")

End If

ElseIf opciones = Windows.Forms.DialogResult.No Then

End If




End If


Catch ex As Exception

End Try

Continue reading...
 
Back
Top