Senin, 10 April 2017

Contoh Penggunaan If pada Visual Studio 2015



KODINGNYA :

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles ButtonHasil.Click
        If radJml.checked = True Then
            textoutput.Text = Val(textinput1.Text) + Val(textinput2.Text)
        End If
        If radmin.checked = True Then
            TextOutput.Text = Val(textinput1.text) - Val(textinput2.text)
        End If
        If radkali.checked = True Then
            textOutput.text = Val(textinput1.text) * Val(textinput2.text)
        End If
        If radBagi.Checked = True Then
            textOutput.text = Val(textinput1.text) / Val(textinput2.text)
        End If
        If radpangkat.checked = True Then
            textoutput.Text = Val(textinput1.Text) ^ Val(textinput2.Text)
        End If
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Label3_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Label4_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Label5_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Label6_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles radjml.CheckedChanged
        Label1.Text = "+"
    End Sub

    Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles radmin.CheckedChanged
        Label1.Text = "-"
    End Sub

    Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles radkali.CheckedChanged
        Label1.Text = "x"
    End Sub

    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles radbagi.CheckedChanged
        Label1.Text = "/"
    End Sub

    Private Sub RadioButton5_CheckedChanged(sender As Object, e As EventArgs) Handles radpangkat.CheckedChanged
        Label1.Text = "^"
    End Sub
End Class


0 komentar:

Posting Komentar