Hi Annie,
For Each classItems As DraftClass In itemsData
oInvoice.Lines.SetCurrentLine(classItems.VisOrder) '<-- Before update, set the line first
oInvoice.Lines.ItemCode = classItems.itemCode
oInvoice.Lines.Price = classItems.PriceBefDi
oInvoice.Lines.PriceAfterVAT = classItems.PriceAfVat
oInvoice.Lines.LineTotal = classItems.LineTotal
oInvoice.Lines.GrossBuyPrice = classItems.GrossProfit
'oInvoice.Lines.Add() <--- updating line, no need to add, unless you want to add a new line
Next
lRetCode = oInvoice.Update()
Regards
Edy