AR_Invoice

Hello

I am trying to edit a AR_invoice using BOI in VB.net

i have tried to set key but no matter what i try i am getting some kind of error

can anyone please help me out on how to set key for a ar_invoice

that code i used :


            If Not (CBool(ar_invoiceObject.nSetKeyValue("InvoiceNo$",invoicenumberlist(i)))) Then MsgBox(ar_invoiceObject.sLastErrorMsg)
            If Not (CBool(ar_invoiceObject.nSetKeyValue("InvoiceType$",intype(i)))) Then MsgBox(ar_invoiceObject.sLastErrorMsg)
            If Not (CBool(ar_invoiceObject.nSetKeyValue("BatchNo$","00004"))) Then MsgBox(ar_invoiceObject.sLastErrorMsg)
            If Not (CBool(ar_invoiceObject.nSetKey())) Then MsgBox(ar_invoiceObject.sLastErrorMsg)
and
            
           If Not (CBool(ar_invoiceObject.nSetKey(invoicenumberlist(i)))) Then MsgBox(ar_invoiceObject.sLastErrorMsg)