Code:
Option Strict On
Public Class Form1
Private Sub btnArea_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnArea.Click
Dim Radius As Double
Dim Area As Double
Radius = Convert.ToDouble(txtRadius.Text)
Area = Radius ^ 2 * 3.14159
lblOutput.Text = "The area of a circle with radius " & Radius & " is: " & Area & ""
End Sub
Private Sub btnVolume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVolume.Click
Dim Radius As Double
Dim Volume As Double
Radius = Convert.ToDouble(txtRadius.Text)
Volume = 4 * Radius ^ 3 * 3.14159 / 3
lblOutput.Text = "The volume of a sphere with radius " & Radius & " is: " & Volume & ""
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
How do I get the results to be displayed in 2 decimal places?
Option Strict On
Public Class Form1
Private Sub btnArea_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnArea.Click
Dim Radius As Double
Dim Area As Double
Radius = Convert.ToDouble(txtRadius.Text)
Area = Radius ^ 2 * 3.14159
lblOutput.Text = "The area of a circle with radius " & Radius & " is: " & Area & ""
End Sub
Private Sub btnVolume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVolume.Click
Dim Radius As Double
Dim Volume As Double
Radius = Convert.ToDouble(txtRadius.Text)
Volume = 4 * Radius ^ 3 * 3.14159 / 3
lblOutput.Text = "The volume of a sphere with radius " & Radius & " is: " & Volume & ""
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
How do I get the results to be displayed in 2 decimal places?