Select to view content in your preferred language

VBS calculate volume in ArcPad form

2273
1
10-02-2013 09:12 AM
EmilySangster1
Occasional Contributor
Hi,
I'm trying to make a button on a custom form which will automatically calculate volume when thickness, length and width are entered by the user. I would like the volume value to appear in a box that is linked to a volume field which will also be populated after the value has been calculated.  I've created a script and a button. In the button events I have it set to "Call CalculateVolume" when clicked and the following script is what it calls.  

Sub CalculateVolume

   'Initializing Variables
   Dim thickness, length, width, volume

   'Setting variables equal to the user inputs
   thickness = InputBox("txtMaterial_thickness")
   length = InputBox("txtMaterial_length")
   width = InputBox("txtMaterial_width")

   'Calculating volume with the user inputs
   volume = thickness * length * width
   MsgBox("Volume " & volume & " Metres cubed")

   'Assigning the volume value to the volume box
   InputBox("txtMaterial_volume") = volume
End Sub

Thanks!
Emily
Tags (3)
0 Kudos
1 Reply
ThaiTruong
Deactivated User
Emily,

Check out this help page on how to set a value to a control.  Hope it helps!
0 Kudos