Buat form seperti berikut ini
Ganti Properti menjadi seperti ini
Isi kode seperti ini
Public Class Form1
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
'---mengisi properti pada objek Form
Me.Text = "Perhitungan Aritmatika"
Me.ControlBox = False
Me.BackColor = Color.DarkSeaGreen
Me.StartPosition = FormStartPosition.CenterScreen
Me.TxtHasil.Enabled = False
Me.TxtHasil.Font.Size.ToString(14)
End Sub
'---event-event untuk tombol proses
Private Sub BtTambah_Click(sender As System.Object, e As System.EventArgs) Handles BtTambah.Click
Dim b1, b2, h As Integer
b1 = Val(TxtBil1.Text)
b2 = Val(TxtBil2.Text)
h = b1 + b2
TxtHasil.Text = Str(h)
End Sub
Private Sub BtKurang_Click(sender As System.Object, e As System.EventArgs) Handles BtKurang.Click
Dim b1, b2, h As Integer
b1 = Val(TxtBil1.Text)
b2 = Val(TxtBil2.Text)
h = b1 - b2
TxtHasil.Text = Str(h)
End Sub
Private Sub BtKali_Click(sender As System.Object, e As System.EventArgs) Handles BtKali.Click
Dim b1, b2, h As Integer
b1 = Val(TxtBil1.Text)
b2 = Val(TxtBil2.Text)
h = b1 * b2
TxtHasil.Text = Str(h)
End Sub
Private Sub BtBagi_Click(sender As System.Object, e As System.EventArgs) Handles BtBagi.Click
Dim b1, b2, h As Integer
b1 = Val(TxtBil1.Text)
b2 = Val(TxtBil2.Text)
h = b1 / b2
TxtHasil.Text = Str(h)
End Sub
Private Sub BtNew_Click(sender As System.Object, e As System.EventArgs) Handles BtNew.Click
Me.TxtBil1.Clear()
Me.TxtBil2.Clear()
Me.TxtHasil.Clear()
Me.TxtBil1.Focus()
End Sub
Private Sub BtClose_Click(sender As System.Object, e As System.EventArgs) Handles BtClose.Click
Me.Close()
End Sub
Private Sub TxtBil1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TxtBil1.KeyPress
If e.KeyChar = Chr(13) Then
Me.TxtBil2.Focus()
End If
End Sub
Private Sub TxtBil2_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TxtBil2.KeyPress
If e.KeyChar = Chr(13) Then
Me.BtTambah.Focus()
End If
End Sub
End Class
Simpan dengan cara menekan logo save all
Kemudian di coba di Run
Selamat mencoba, atau download program dengan source code disini.
Thіs ԁesign іѕ іncrеԁible!
ReplyDeleteΥou most cеrtаinly know hοw to κeеp а reaԁer entertained.
Between yοuг wit and уour ѵideοs,
I waѕ almost moveԁ to ѕtart mу own blog (wеll,
аlmost...HaHа!) Great јob.
І reallу lοved what you had to say, anԁ mоге thаn that, how you preѕеntеd it.
Too cοol!
Feel free to ѕurf to mу web page: http://www.kiwibox.com