Page 66 - Programming VB.NET
P. 66

62                       Chapter 6: Procedures And Functions


                   Function GetCircleArea(ByVal rad As Integer)
                   As Double

                           Dim luas As Double

                           luas = 3.142 * rad * rad
                           Return luas

                   End Function



                   Private Sub btncal_Click(ByVal sender As
                   System.Object,

                   ByVal e As System.EventArgs) Handles
                   btncal.Click

                           Dim radius As Integer

                           Dim kira As Double

                           radius = txtradius.Text
                           kira = GetCircleArea(radius)

                           lblarea.Text = kira.ToString("n2")

                   End Sub
   61   62   63   64   65   66   67   68   69   70   71