1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using .net In The Abl

Discussion in 'APIs' started by Jim Hurley, Aug 3, 2017.

  1. Jim Hurley

    Jim Hurley New Member

    At the last PUG Exchange, Tom Bergman gave a great lecture with examples about how to use .NET classes in the ABL programming environment. I was able to download the archive of his examples, but I am not able to get the ones I am most interested in to compile.

    The error I get is sort of consistent over several pieces of code. Here is one example:
    Code (progress):
    1.  
    2. /*------------------------------------------------------------------------
    3.     File        : DeviceLocation.p
    4.     Purpose     :
    5.  
    6.     Syntax      :
    7.  
    8.     Description :
    9.  
    10.     Author(s)   :
    11.     Created     : Wed May 11 08:33:30 EDT 2016
    12.     Notes       :
    13.   ----------------------------------------------------------------------*/
    14. USING System.*.
    15. USING System.Device.Location.*.
    16.  
    17. DEF VAR Watcher AS GeoCoordinateWatcher.
    18. DEF VAR coord   AS GeoCoordinate.
    19.  
    20. Watcher = NEW GeoCoordinateWatcher().
    21. Watcher:TryStart(FALSE, TimeSpan:FromMilliseconds(1000)).
    22. coord = Watcher:Position:Location.
    23.  
    24. IF NOT coord:IsUnknown THEN
    25. DO:
    26.   MESSAGE coord:Latitude "x" coord:Longitude
    27.   VIEW-AS ALERT-BOX.
    28. END.
    29.  
    30.  
    31. MESSAGE "done"
    32.   VIEW-AS ALERT-BOX.
    33.  
    **********************************************

    This code is giving me the following error:

    Invalid datatype specified: GeoCoordinateWatcher. Specify a datatype such as 'character' or the name of a class. (5638)
    ** Could not understand line 17. (196)

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

    I feel like there is something simple missing or perhaps not installed, but other examples do compile and run.

    I am running this in an 11.3.2 version of Progress.

    Thanks in advance,

    Jim Hurley
     
    Last edited by a moderator: Aug 7, 2017
  2.  
  3. Osborne

    Osborne Active Member

    I am not familiar with System.Device.Location.GeoCoordinateWatcher, but think it was introduced in .NET 4.0 and is part of System.Device.dll. Do you have this installed on the relevant PC?

    If installed, you most likely need to add to assemblies.xml. If you have added and it is being picked up okay try changing line 15 to:
    Code (progress):
    1. USING System.Device.Location.* FROM ASSEMBLY.
     

Share This Page