How to pass a variant value to CFRONT object (Navision) ?

Hi,

I need to pass a string value to a COM Object the method styax as follow


S/W Name : NAVISION

COM Object : CFRONT.OCX


Method AssignField( hTable as Long, hRec as Long, FieldData as Variant) as Void

My program source code is

************************************************************

loCF = Createobject("cfront.cfrontctrl.1")

lc_Data = "Testing"
loCF.AssignField( 1, 2, lc_Data)


************************************************************

But return error message "Type Mismatch"

How can fix it

Thank you for help



Answer this question

How to pass a variant value to CFRONT object (Navision) ?

  • Kent Boogaart

    No, the main problem is come from lc_Data value type - Variant Type.
  • Nathan Going

    Hi

    I'm trying to learn Navision Development ,but I didn't get proper way to learn ,

    I've good knowledge in developing with .NET.

    can anybody help me to learn Navision.

    I'm looking for resources to learn

    Thanks in advance



  • KGW

    I had a similar problem last week:

    A VB6 project with a .Net dll:

    Solution: Make 1 or more variables as variant.

    And then call the procedure

    so:

    dim temp1

    temp1 = 1

    functionxx(temp1)

    By the way: I use the CFront.dll (not CFront.ocx)

    Dick

    www.dasautomatisering.nl



  • Jan Sten

    Why are you asking this in a Forum dedicated to Visual FoxPro You may get an answer in one of the more relevant Windows Forums....

  • PhantomX

    Does not make sense. It accepts variant and you are passing text.

    Pass it directly ansd see if it works.

    loCF.AssignField(1.0,2.0,"Test")

    assuming these are correct values.


  • Jane2006

    Ummm, "Variant" means that it does not require a particular data type - it could be Text, Decimal, Integer DateTime - whatever!

    From what you have posted, your code should work as far as I can see. So more likely is that one of the other parameters is incorrect or that, despite the "Variant" declaration it is really requiring a specific data type (i.e. not a character string).

    But without more detailed documentation or access to the source code it is not possible to tell. 

     



  • Attos

    Try to see if it works this way:

    loCF.AssignField(1.0,2.0,lc_Data)

    as it seems it does not like integers (expects long).


  • How to pass a variant value to CFRONT object (Navision) ?