kdalbert11

VBA migration to vb.net -- call pe.dll ?

Discussion created by kdalbert11 on Mar 31, 2011
Hello,

How can I call ESRI's pe.dll from vb.net?
in VBA I often use a simple call from any Sub to the pe.dll to obtain values for geodesic calculation:

Exmpl:

[INDENT]Private Declare Function geodcoord Lib "D:\ArcGIS\Desktop10.0\Bin\pe.dll" _
  Alias "pe_geodesic_coordinate" (ByVal a As Double, ByVal e2 As Double, _
  ByVal lam1 As Double, ByVal phi1 As Double, _
  ByVal distance As Double, ByVal azi12 As Double, _
  lam2 As Double, phi2 As Double) As Long[/INDENT]

[INDENT]Public sub any()
Dim dLong As Double, dLat As Double
Dim dRadius As Double, azi12c As Double
Dim lon2c As Double, lat2c As Double
Dim lam1 As Double, phi1 As Double
Dim lam2 As Double, phi2 As Double
Dim distance As Double
Dim a12 As Double

  SetSpheroid a, e2

  lam1 = dLong * DDtoRAD
  phi1 = dLat * DDtoRAD
  a12 = azi12c * DDtoRAD
  distance = dRadius

' The function is called.
  geodcoord a, e2, lam1, phi1, distance, a12, lon2c, lat2c
 
' In this case I continue working with the lon2c, lat2c values
  lon2c = lon2c / DDtoRAD
  lat2c = lat2c / DDtoRAD

End Sub[/INDENT]


If I try the same from a sub in vb.net, the values of lon2c, lat2c are 0.

Thank's in advance for any idea to solve this problem

KLaus

(ArcGIS 10, WIN7, VS2010)

Outcomes