• Minggu, 20 Mei 2018

    Assalamualaikum semua, kali ini saya akan berbagi tentang bagaimana cara membuat program sederhana menggunakan microsoft visual basic 2008. Oke simak baik-baik yahhh.

    Pertama kita akan membuat program mengihtung luas persegi panjang.

    Usahakan untuk desain form agak dibedakan agar supaya kalian mengerti dan berkreasi sendiri.

    selanjutnya skrip kodenya dibawah ini

    Public Class Form2

        Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox2.Enter

        End Sub

        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
            Close()
        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
            txtpanjang.Clear()
            txtlebar.Clear()
            txtluas.Clear()
            txtkeliling.Clear()
        End Sub

        Private Sub txtp_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtpanjang.TextChanged

        End Sub

        Private Sub txtl_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtlebar.TextChanged

        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim panjang, lebar As Integer
            Dim Luas As Integer
            Dim Keliling As Integer

            panjang = Val(txtpanjang.Text)
            lebar = Val(txtlebar.Text)
            Luas = Val(txtluas.Text)
            Keliling = Val(txtkeliling.text)

            Luas = (panjang * lebar)
            txtluas.Text = Luas

            Keliling = (2 * (panjang + lebar))
            txtkeliling.Text = Keliling
        End Sub
    End Class

    Kedua kita akan membuat program luas lingakaran

    Sama usahakan untuk desain form kalian kreasikan sendiri.

    untuk skrip kodenya dibawah ini

    Public Class MenghitungLuasLigkaran

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        End Sub

        Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
            luas.Text = 22 / 7 * jari_jari.Text * jari_jari.Text
            keliling.Text = 2 * 22 / 7 * jari_jari.Text
        End Sub

        Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
            Me.Close()

        End Sub

        Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
            jari_jari.Text = ""
            luas.Text = ""
            keliling.Text = ""

        End Sub


        Private Sub jari_jari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jari_jari.TextChanged

        End Sub
    End Class

    Ketiga kita akan membuat program menghitung volume tabung

    Desain form bisa kalian kreasikan menurut keinginan kalian

    Untuk skrip kode ada dibawah ini

    Public Class VolumeTabung

        Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
            hasil.Text = 22 / 7 * radius.Text * radius.Text * tinggi.Text
        End Sub

        Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
            Me.Close()
        End Sub

        Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
            radius.Text = ""
            tinggi.Text = ""
            hasil.Text = ""
        End Sub
    End Class

    Keempat kita akan membuat program mini market kita semua menggunakan combo box

    Untuk desain form bisa kalian buat sekreatif mungkin

    Skrip Kode dibawah ya sobb

     Public Class Form4

        Private Sub Cbokb_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cbokb.SelectedIndexChanged
            If Cbokb.Text = "PL01" Then
                TxtNb.Text = "PULPEN PILOT"
                TxtHb.Text = 1200
            ElseIf Cbokb.Text = "PL02" Then
                TxtNb.Text = "PULPEN STANDAR"
                TxtHb.Text = 1000
            ElseIf Cbokb.Text = "BK01" Then
                TxtNb.Text = "BUKU AA 60 LBR"
                TxtHb.Text = 3800
            Else : TxtNb.Text = "BUKU SINAR DUNIA 50"
                TxtHb.Text = 3000

            End If
        End Sub

        Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Cbokb.Items.Add("PL01")
            Cbokb.Items.Add("PL02")
            Cbokb.Items.Add("BK01")
            Cbokb.Items.Add("BK02")
        End Sub

        Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
            TextBox2.Text = TextBox1.Text * TxtHb.Text
        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            TxtHb.Clear()
            TxtNb.Clear()
            TextBox1.Clear()
            TextBox2.Clear()
            Cbokb.Text = ""
        End Sub

        Private Sub BtnTutup_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTutup.Click
            Close()
        End Sub
    End Class
     

    Terakhir kita akan membuat program form data barang




    Skrip kodenya dibawah yaahh

    Public Class Form1
        Dim A As Integer
        Private Sub ListView1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListView1.SelectedIndexChanged

        End Sub

        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            CboKode.Items.Add("H001")
            CboKode.Items.Add("H002")
            CboKode.Items.Add("Y001")
            CboKode.Items.Add("Y002")
        End Sub

        Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CboKode.SelectedIndexChanged


        End Sub

        Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
            ListView1.Items.Add(TxtTransaksi.Text)
            ListView1.Items(A).SubItems.Add(CboKode.Text)
            ListView1.Items(A).SubItems.Add(TxtMerk.Text)
            ListView1.Items(A).SubItems.Add(TxtType.Text)
            ListView1.Items(A).SubItems.Add(TxtSatuan.Text)
            ListView1.Items(A).SubItems.Add(TxtJumlah.Text)
            ListView1.Items(A).SubItems.Add(TxtTotal.Text)
            ListView1.Items(A).SubItems.Add(TxtDiskon.Text)
            ListView1.Items(A).SubItems.Add(TxtBayar.Text)
            A = A + 1
        End Sub

        Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtMerk.TextChanged

        End Sub

        Private Sub BtnHitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHitung.Click
            TxtTotal.Text = TxtJumlah.Text * TxtSatuan.Text
            If TxtType.Text = "Supra fit" And TxtJumlah.Text > 5 Then
                TxtDiskon.Text = 5 / 100 = TxtTotal.Text
            ElseIf TxtType.Text = "Mio" And TxtJumlah.Text > 5 Then
                TxtDiskon.Text = 10 / 100 = TxtTotal.Text
            Else
                TxtDiskon.Text = 0
            End If
            TxtBayar.Text = TxtTotal.Text - TxtDiskon.Text
        End Sub

        Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtTransaksi.TextChanged

        End Sub

        Private Sub BtnBersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBersih.Click
            TxtBayar.Text = ""
            TxtDiskon.Text = ""
            TxtJumlah.Text = ""
            TxtMerk.Text = ""
            TxtSatuan.Text = ""
            TxtTotal.Text = ""
            TxtTransaksi.Text = ""
            TxtType.Text = ""
            CboKode.Text = ""
        End Sub

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCari.Click
            If CboKode.Text = "H001" Then
                TxtMerk.Text = "Honda"
                TxtType.Text = "Supra fit"
                TxtSatuan.Text = 9000000
            ElseIf CboKode.Text = "H002" Then
                TxtMerk.Text = "Honda"
                TxtType.Text = "Supra X"
                TxtSatuan.Text = 11000000
            ElseIf CboKode.Text = "Y001" Then
                TxtMerk.Text = "Yamaha"
                TxtType.Text = "Mio"
                TxtSatuan.Text = 13000000
            Else
                TxtMerk.Text = "Yamaha"
                TxtType.Text = "Jupiter"
                TxtSatuan.Text = 12000000

            End If
        End Sub

        Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
            End
        End Sub
    End Class

    Oke itu dulu mengenai latihan membuat program pada vb net 2008. Silahkan kalian kreasikan sendiri. Wassalamualaikum wr wb

     



     

    Leave a Reply

    Subscribe to Posts | Subscribe to Comments

  • Copyright © - Aldi Fikri Blog Perkuliahan

    Aldi Fikri Blog Perkuliahan - Powered by Blogger - Designed by Johanes Djogan