Hello, can someone help me understand why my code isn’t working?
I’m trying to read each ‘nLote’ tag contained in the XML of an NFe (Nota Fiscal eletrônica, Brazilian Electronic Invoice), but when I execute the code, I get the following error: ‘Assign: Object reference not set to an instance of an object.’"
for each:xmlDeserialized.Element(ns+“nfeProc”).Element(ns+“NFe”).Element(ns+“infNFe”).Element(ns+“det”).Elements(ns+“prod”).Elements(ns+“rastro”)
I managed to fix the error, but now it only returns the result to me once, and it should be correct five times, as I have five items.
For Each: xmlDeserialized.Element(ns+“nfeProc”).Element(ns+“NFe”).Element(ns+“infNFe”).Element(ns+“det”).Elements(ns+“prod”).Elements(ns+“rastro”).Elements(ns+“nLote”)