I have adapted <ABX's example from this thread, is the volume the same as the cubic area?
I am inputting metric numbers [ radius = 600mm, height = 1000mm]
Answer = 1.131 m3Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Height As Double Dim Radius As Double Dim Volume As Double Try Height = Double.Parse(Me.TextBox2.Text) / 1000 Radius = Double.Parse(Me.TextBox1.Text) / 1000 'Call the function to get the volume Volume = VolumeOfCylinder(Radius, Height) Volume = Math.Round(Volume, 3) MsgBox("The Cubic Meters of the Cylinder is: " & Volume.ToString & "m3") Catch ex As Exception MsgBox("Enter Numbers only in the Textboxes") End Try End Sub Public Function VolumeOfCylinder(ByVal Radius As Double, ByVal Height As Double) As Double Return CDec((Math.PI * Radius ^ 2 * Height)) End Function
regards
toe




Reply With Quote