autoincrement rows of a datagridview

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

dianas28

Guest
Good evening, my question is the following I already know how to read the xml file, my problem is now that my column Number Invoice is not self-increasing, I don't know why the problem is being debated. I leave my progress.

I would like the autoincrement to be seen when I call it in the datagridview, but I don't know how.

With _columnaNumeroFactura
'Numero de factura
.DataType = System.Type.GetType("System.Int32")
.Caption = "NumeroFactura"
.ColumnName = "NÚMERO FACTURA"
.ReadOnly = True
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
_dtEmpresas.Columns.Add(_columnaNumeroFactura)
End With

With _columnaCedulaJuridica
'Cedula Juridica
.DataType = System.Type.GetType("System.Int64")
.Caption = "CedulaJuridica"
.ColumnName = "CÉDULA JURÍDICA"
.ReadOnly = True
_dtEmpresas.Columns.Add(_columnaCedulaJuridica)
End With

With _columnaRazonSocial
'Cedula Juridica
.DataType = System.Type.GetType("System.String")
.Caption = "RazonSocail"
.ColumnName = "RAZÓN SOCIAL"
.ReadOnly = True
_dtEmpresas.Columns.Add(_columnaRazonSocial)
End With

_archivoXML = New XmlDocument
_archivoXML.Load(Application.StartupPath & "\Empresas.xml") 'Carga del archivo XML
_listaNodo = _archivoXML.SelectNodes("/Empresas/Empresa") 'Seleccion de la lista nodos, que tiene nuestro archivo XML.
For Each _Nodo In _listaNodo

Dim fila As DataRow = _dtEmpresas.NewRow

fila("NÚMERO FACTURA") = _Nodo.SelectSingleNode("NumeroFactura").InnerText
fila("CÉDULA JURÍDICA") = _Nodo.SelectSingleNode("CedulaJuridica").InnerText
fila("RAZÓN SOCIAL") = _Nodo.SelectSingleNode("RazonSocial").InnerText



_dtEmpresas.Rows.Add(fila)

Next

dgvConsultar.DataSource = _dtEmpresas



This is my file xml

<Empresas>
<Empresa>
<CedulaJuridica>3101162637</CedulaJuridica>
<RazonSocial>kUNG FU PANDA MOVIES S A</RazonSocial>
<Direccion/>
<Provincia/>
<Canton/>
<Telefono/>
</Empresa>
<Empresa>
<CedulaJuridica>3101162639</CedulaJuridica>
<RazonSocial>VILLAS DE ORO DEL PURISCAL S A</RazonSocial>
<Direccion/>
<Provincia/>
<Canton/>
<Telefono/>
</Empresa>
<Empresa>

Continue reading...
 
Back
Top