Nama : SRIWAHYUNI NIM : 19010020Public Class Form1
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click Close() End Sub
Private Sub btnhitungl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhitungl.Click Dim p, l As New Integer Dim h As New Double If tbpanjang.Text = "" Then MsgBox("Masukkan Panjangnya!", MsgBoxStyle.Critical, "Peringatan") ElseIf tbluas.Text = "" Then MsgBox("Masukkan Lebarnya!", MsgBoxStyle.Critical, "Peringatan") Else p = Val(tbpanjang.Text) l = Val(tbluas.Text) h = p * l tbhasil.Text = h End If End Sub
Private Sub btnhitungk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhitungk.Click Dim p, l As New Integer Dim h As New Double If tbpanjang.Text = "" Then MsgBox("Masukkan Panjangnya!", MsgBoxStyle.Critical, "Peringatan") ElseIf tbluas.Text = "" Then MsgBox("Masukkan Lebarnya!", MsgBoxStyle.Critical, "Peringatan") Else p = Val(tbpanjang.Text) l = Val(tbluas.Text) h = 2 * (p + l) tbhasil.Text = h End If End Sub
Private Sub btnKosongkan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnKosongkan.Click tbpanjang.Text = "" tbluas.Text = "" tbhasil.Text = "" tbhasil.Enabled = False End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load tbhasil.Enabled = False End Sub
Private Sub tbpanjang_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tbpanjang.KeyPress If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled = True End Sub
Private Sub tbluas_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tbluas.KeyPress If Not ((e.KeyChar >= "0" And e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled = True End SubEnd Class
|
Komentar
Posting Komentar