Fungsi Operator Pada VB NET

Fungsi Operator VB NET
Koding :
Public Class Form1


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        hasil.Text = Val(nilai1.Text) * Val(nilai2.Text)
        'perkalian
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        hasil.Text = nilai1.Text / nilai2.Text
        'pembaian
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        hasil.Text = Val(nilai1.Text) + Val(nilai2.Text)
        'penjumlahan
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        hasil.Text = Val(nilai1.Text) - Val(nilai2.Text)n
        'penguranga
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        hasil.Text = Val(nilai1.Text) ^ Val(nilai2.Text)
        'pangkat
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        hasil.Text = nilai1.Text > nilai2.Text
        'lebih besar dari
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        hasil.Text = nilai1.Text < nilai2.Text
        'lebih kecil dari
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        hasil.Enabled = False
        'menutup textbox hasil supaya tidak bisa diedit
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        hasil.Text = nilai1.Text & "" & nilai2.Text
        'sebagai penghubung
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        hasil.Text = Val(nilai1.Text) \ Val(nilai2.Text)
        'pembagian genap
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        hasil.Text = nilai1.Text Mod nilai2.Text
        'menghitung sisa bagi
    End Sub
End Class

Berlangganan update artikel terbaru via email:

Tampilkan Komentar

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel