AssignField() Navision 4.0

cloudnine
cloudnine Member Posts: 25
Hi guys...

I have read entries in the forum about their problems on AssignField method of C/FRONT...I'm also one of them...i cant seem to make my application inserting a new record using AssignField method work...It always throws an exception error "type mismatch"...Im working my application in C#.NET...

here are some of my codes:

from the MetaData:

Public virtual void AssignField(int hTable, int hRec, int FieldNo, ref object FieldData)

from my application code:

string myString = "B1";
object myObject = myString;

test.AssignField(hTable, hRec, 1, ref myObject);

test.InsertRec(hTable, hRec);

what seems to be the problem...the problem is on the last argument from AssignField...what is the proper way to use it...

Thanks in advance...

Comments

  • pbally
    pbally Member Posts: 4
    I have a similar problem with VB .Net and C/Front for a 3.6 version of NAV.

    Code :
    hRec = Cf.AllocRec(hTable)
    Cf.BWT()
    Cf.SetFilter(hTable, Zone1, TextBox1.Text)
    Cf.FindRec(hTable, hRec, "-")
    Cf.AssignField(hTable, hRec, Zone2, "A")

    Error code : Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))

    Zone2 is relative to a Text Data Type in Nav

    I get the error on the fourth parameter of Assignfield.

    Has someone an idea of the solution?
    Thanks.