Using .net In The Abl

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:
/*------------------------------------------------------------------------
    File        : DeviceLocation.p
    Purpose     :

    Syntax      :

    Description :

    Author(s)   :
    Created     : Wed May 11 08:33:30 EDT 2016
    Notes       :
  ----------------------------------------------------------------------*/
USING System.*.
USING System.Device.Location.*.

DEF VAR Watcher AS GeoCoordinateWatcher.
DEF VAR coord   AS GeoCoordinate.

Watcher = NEW GeoCoordinateWatcher().
Watcher:TryStart(FALSE, TimeSpan:FromMilliseconds(1000)).
coord = Watcher:Position:Location.

IF NOT coord:IsUnknown THEN
DO:
  MESSAGE coord:Latitude "x" coord:Longitude
  VIEW-AS ALERT-BOX.
END.


MESSAGE "done"
  VIEW-AS ALERT-BOX.
**********************************************

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:

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:
USING System.Device.Location.* FROM ASSEMBLY.
 

Cecil

19+ years progress programming and still learning.
How did you get on with your problem? I having the same issue with another 3rd party .NET object.

Also, have you tried specifying the CLASS parameter:

Code:
DEF VAR Watcher AS CLASS GeoCoordinateWatcher.
DEF VAR coord   AS CLASS GeoCoordinate
 
Top