you don't declare variables as any specific data type in VB.net. probably work just dropping the "as double" part. The python alternative involves way less typing. Here is Chris Fox's crash course in python geometry:
I have passed along this idea for a future topic/article in some of our publications. I think a brief explination of what is happening in my field calculator expression will really help you in the future if you need to work with Geometries in the field calculator.
When you use the expression !Shape! in the field calculator you are returning the Geometry of the feature, because the geometry is stored in the Shape field. Through python we have defined a Geometry Class and this class defines the properties and methods availble to this Geometry Object.
If you look at the help topic link for the Geometry Class you will see a section for Properties. Under this section you will see properties like, area, extent, lastPoint, pointCount, etc. Each property has a brief description and a data type. To return a reference to the value in these properties you just add a "." after the reference to the Geometry, !Shape!, and then type the property name.
!Shape!.area
##returns the area value expressed as a date type double
!Shape!.pointCount
##returns the number of points/vertices in the feature expressed as a date type Integer
Now notice how some properties have a data type of Point or Extent. If you look in the tree view of the same help topic you will find corresponding topics for the Point Class or Extent Class. For example take the property firstPoint that has a data type of Point. What this means is if we write something like:
!Shape!.firstPoint
We will return a reference to the Point who has its own properties which are defined within the Point Class help topic. If you look in that help topic you will see the following properties, ID, X, Y, Z, M. So finally if we write the expression:
!Shape!.firstPoint.Z
Where:
!Shape! returns the Geometry
firstPoint returns the first Point in the Geometry
Z returns the Z value of the first Point in the Geometry as a Double
If you apply this knowledge in navigating the help documentation you can really utilize the full functionality of working with Geometries in the field calculator.
Chris Fox
Development Technical Lead
User Advocacy Group
Esri Support Services