virtualakademik

Latihan Operator

Jul 31st, 2017
1,195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Private Sub btTambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btTambah.Click
  4.         Dim b1, b2 As New Integer
  5.         Dim h As New Double
  6.         b1 = Val(txtBil1.Text)
  7.         b2 = Val(txtBil2.Text)
  8.         h = b1 + b2
  9.         txtHasil.Text = h
  10.     End Sub
  11.  
  12.     Private Sub btKurang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btKurang.Click
  13.         Dim b1, b2 As New Integer
  14.         Dim h As New Double
  15.         b1 = Val(txtBil1.Text)
  16.         b2 = Val(txtBil2.Text)
  17.         h = b1 - b2
  18.         txtHasil.Text = h
  19.     End Sub
  20.  
  21.     Private Sub btKali_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btKali.Click
  22.         Dim b1, b2 As New Integer
  23.         Dim h As New Double
  24.         b1 = Val(txtBil1.Text)
  25.         b2 = Val(txtBil2.Text)
  26.         h = b1 * b2
  27.         txtHasil.Text = h
  28.     End Sub
  29.  
  30.     Private Sub btBagi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btBagi.Click
  31.         Dim b1, b2 As New Integer
  32.         Dim h As New Double
  33.         b1 = Val(txtBil1.Text)
  34.         b2 = Val(txtBil2.Text)
  35.         h = b1 / b2
  36.         txtHasil.Text = h
  37.     End Sub
  38.  
  39.     Private Sub btNew_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btNew.Click
  40.         txtBil1.Clear()
  41.         txtBil2.Clear()
  42.         txtHasil.Clear()
  43.         txtBil1.Focus()
  44.     End Sub
  45.  
  46.     Private Sub btClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btClose.Click
  47.         Me.Close()
  48.  
  49.     End Sub
  50.  
  51.     Private Sub txtBil1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtBil1.KeyPress
  52.         If e.KeyChar = Chr(13) Then
  53.             Me.txtBil2.Focus()
  54.         End If
  55.     End Sub
  56.  
  57.     Private Sub txtBil2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtBil2.KeyPress
  58.         If e.KeyChar = Chr(13) Then
  59.             Me.btNew.Focus()
  60.         End If
  61.     End Sub
  62. End Class
Advertisement
Add Comment
Please, Sign In to add comment