VB.NET: Contoh Project Kalkulator Lingkaran

Design UI

Code
Public Class Form1
  Dim r As Single
  Const phi As Single = 3.14

  Private Sub Form1_Load(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles MyBase.Load
      txtRad.Text = 24
      r = txtRad.Text
  End Sub

  Private Sub txtRad_TextChanged(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles txtRad.TextChanged
      r = txtRad.Text
  End Sub

  Private Sub btnCalc_Click(ByVal sender As System.Object, _
          ByVal e As System.EventArgs) Handles btnCalc.Click
      lblCirc.Text = 2 * phi * r
      lblArea.Text = phi * (r ^ 2)
  End Sub
End Class


Runtime



Click here if you like this article.


Post a Comment

0 Comments