“Everybody in this country should learn to program a computer, because it teaches you how to think.”

Masukkan Kata Kunci Pencarian Anda Disini

Saturday 16 July 2011

Fungsi Aritmatika di VB. Net 2010

Buat form seperti berikut ini
vb.net 2010

Ganti Properti menjadi seperti ini
vb.net 2010
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
vb.net 2010
Kemudian di coba di Run
vb.net 2010
Selamat mencoba, atau download program dengan source code disini.

1 comment:

  1. Thіs ԁesign іѕ іncrеԁible!

    Υ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

    ReplyDelete

Gunakan bahasa yang baik dan sopan. Komentar yang berbau SARA akan di HAPUS / DELETE.
Komentar akan muncul setelah mendapat persetujuan dari Admin Anak Rantau.