Senin, 25 Januari 2016

UJIAN AKHIR SEMESTER MEMBUAT PROGRAM KALKULATOR SEDERHANA CARA 1

UJIAN AKHIR SEMESTER MEMBUAT PROGRAM KALKULATOR SEDERHANA
Berikut adalah coding cara membuat calculator : 
Public Class Form1
    Dim nilai, hasil, angka As Integer
    Dim simbol As String
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        hasil = txthasilcalculator.Text
        simbol = "+"
        txthasilcalculator.Text = ""
       
    End Sub
   
  
    Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click
        End
    End Sub

    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click

    End Sub


    Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "1"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "1"
        End If
        Me.Button14.Text = "&1"
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "7"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "7"
        End If
        Me.Button5.Text = "&7"
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "8"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "8"
        End If
        Me.Button6.Text = "&8"
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "9"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "9"
        End If
        Me.Button7.Text = "&9"
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "4"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "4"
        End If
        Me.Button9.Text = "&4"
    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "5"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "5"
        End If
        Me.Button10.Text = "&5"
    End Sub

    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "6"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "6"
        End If
        Me.Button11.Text = "&6"
    End Sub

    Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "2"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "2"
        End If
        Me.Button15.Text = "&2"
    End Sub

    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "3"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "3"
        End If
        Me.Button16.Text = "&3"
    End Sub

    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
        If txthasilcalculator.Text = "0" Then
            txthasilcalculator.Text = "0"
        Else : txthasilcalculator.Text = txthasilcalculator.Text & "0"
        End If
        Me.Button18.Text = "&0"
    End Sub

    Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click

        If simbol = "+" Then
            hasil = nilai + Val(txthasilcalculator.Text)
            txthasilcalculator.Text = hasil
        ElseIf simbol = "-" Then
            hasil = nilai - Val(txthasilcalculator.Text)
            txthasilcalculator.Text = hasil
        ElseIf simbol = "X" Then
            hasil = nilai * Val(txthasilcalculator.Text)
            txthasilcalculator.Text = hasil
        ElseIf simbol = "/" Then
            hasil = nilai / Val(txthasilcalculator.Text)
            txthasilcalculator.Text = hasil
        End If
    End Sub

    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
        If txthasilcalculator.Text = "," Then
            txthasilcalculator.Text = ","
        Else : txthasilcalculator.Text = txthasilcalculator.Text & ","
        End If
        Me.Button19.Text = "&."
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        nilai = txthasilcalculator.Text
        simbol = "-"
        txthasilcalculator.Text = ""
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        nilai = txthasilcalculator.Text
        simbol = "/"
        txthasilcalculator.Text = ""
    End Sub

    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
        Me.txthasilcalculator.Clear()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        nilai = txthasilcalculator.Text
        simbol = "X"
        txthasilcalculator.Text = ""
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        If txthasilcalculator.Text.Length <> 0 Then
            txthasilcalculator.Text = txthasilcalculator.Text.Remove(txthasilcalculator.TextLength - 1, 1)
        End If
    End Sub

    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
        txthasilcalculator.Text = "-" & Val(txthasilcalculator.Text)
    End Sub
End Class
MOHON MAAF JIKA TERDAPAT KESALAHAN DALAM CODING 

MEMBUAT MENU UTAMA

MEMBUAT MENU UTAMA
 
ASSALAMU'ALAIKUM WARAHMATULLAHI WABAROKATUH :)
 
SELAMAT DATANG DI BLOG SAYA, SAYA AKAN MEMPOSTING MENGENAI  PROGRAM VISUAL BASIC 10 YANG SAYA BUAT

PROJECT LATIHAN  MEMBUAT MENU UTAMA:
 
MENU UTAMA BERFUNGSI SUPAYA KITA DAPAT MENGUMPULKAN SEMUA LATIHAN DALAM SATU RUN ATAU FORM :
 
BERIKUT CODING MEMBUAT MENU UTAMA :

Public Class utama

    Private Sub Blat4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat4.Click
        Me.Enabled = False
        Latihan4.Show()
    End Sub

    Private Sub Blat5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat5.Click
        Me.Enabled = False
        Lat5.Show()
    End Sub

    Private Sub Blat6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat6.Click
        Me.Enabled = False
        Latihan6.Show()
    End Sub

    Private Sub Blat7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat7.Click
        Me.Enabled = False
        latihan7.Show()
    End Sub

    Private Sub Blat8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat8.Click
        Me.Enabled = False
        latihan8.Show()
    End Sub

    Private Sub Blat9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat9.Click
        Me.Enabled = False
        latihan9.Show()
    End Sub

    Private Sub Blat10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Blat10.Click
        Me.Enabled = False
        Frm_lat10.Show()
    End Sub

    Private Sub Blat11_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat11.Click
        Me.Enabled = False
        Formlatihan11.Show()
    End Sub

    Private Sub Blat12_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat12.Click
        Me.Enabled = False
        Formlat12.Show()
    End Sub

    Private Sub Blat13_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat13.Click
        Me.Enabled = False
        Frmlat_13.Show()
    End Sub

    Private Sub Blat14_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat14.Click
        Me.Enabled = False
        frmlat14.Show()

    End Sub

    Private Sub Blat15_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat15.Click
        Me.Enabled = False
        Formlat_15.Show()
    End Sub

    Private Sub Blat16_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Blat16.Click
        Me.Enabled = False
        Formlat16.Show()

    End Sub

    Private Sub B17_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles B17.Click
        Me.Enabled = False
        Formlat_17.Show()
    End Sub
End Class

SEMOGA BERMANFAAT BAGI KALIAN SEMUA
KETAHUILAH BAHWA DALAM HAL INI TIDAK LUPUT DARI SALAH , MAKA SARAN DAN KRITIK SANGAT SAYA BUTUHKAN