Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0
Accepted Solution

C# and nEOF

Anybody knows how to use nEOF in C#?


Here is my code:

using (DispatchObject invoice_line = new DispatchObject(invoice.GetProperty("oLines")))
{
     int eof = 0;
     retVal = invoice_line.InvokeMethod("nMoveFirst");
     retVal = invoice_line.InvokeMethod("nEOF", eof); <-- error
     LogMsg(string.Format("[Detail# Exists? {0}", retValText(eof)));

     while (eof != 1) //detail exists
     {
       object[] getValueParams = new object[] { "ITEMCODE$", "" };
       retVal = invoice_line.InvokeMethodByRef("nGetValue", getValueParams);

       LogMsg(string.Format("[nGetValue] OK? {0}", retValText(retVal)));
       LogMsg(string.Format("[{1}] {0}", getValueParams[1], "ITEMCODE$"));

       //find next row
       retVal = invoice_line.InvokeMethod("nMoveNext");
       retVal = invoice_line.InvokeMethod("nEOF", eof);
       LogMsg(string.Format("[Detail# Exists? {0}", retValText(eof)));
     }
}

 

I am getting this:
Exception has been thrown by the target of an invocation.<Method name not found>

 

Thank you,
George

Moderator
Natasha
Posts: 180
Registered: 07-15-2009
0

Re: C# and nEOF

I don't know the C# syntax.  nEOF is a property of the invoice_line object, not a method.

 

Natasha Chang
Sr. Software Engineer
Sage 100 ERP
Sage MAS Partner
cspirz
Posts: 19
Registered: 11-14-2008
0

Re: C# and nEOF

use: int eof = invoice.GetProperty("nEOF")

 

or while( invoice.GetProperty("nEOF") != 1 ) { }

Contributor
ebdeveloper
Posts: 15
Registered: 01-23-2012
0

Re: C# and nEOF

Thank you, I did not realize it is the property :smileysurprised: