Kamis, 12 Maret 2015

Perhitungan bangun datar dan bangun ruang dengan VB 2008







Public Class From_perhitungan
    Public Sub clear()
        cbNmBgn.Items.Clear()
        cbProses.Items.Clear()
    End Sub
    Private Sub From_volume_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Text = "Perhitungan Bangun Ruang"
    End Sub
    Private Sub btnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProses.Click
        If cbProses.SelectedItem = "Luas" Then
            If cbNmBgn.SelectedItem = "Persegi" Then
                Dim Lpersegi As New rumus
                Lpersegi.Luas_Persegi()
            ElseIf cbNmBgn.SelectedItem = "Persegi Panjang" Then
                Dim Lpersegipnjng As New rumus
                Lpersegipnjng.Luas_PersegiPnjng()
            ElseIf cbNmBgn.SelectedItem = "Segitiga" Then
                Dim Lsegitiga As New rumus
                Lsegitiga.Luas_Segitiga()
            ElseIf cbNmBgn.SelectedItem = "Lingkaran" Then
                Dim Llingkaran As New rumus
                Llingkaran.Luas_Lingkaran()
            ElseIf cbNmBgn.SelectedItem = "Trapesium" Then
                Dim Ltrapesium As New rumus
                Ltrapesium.Luas_Trapesium()
            ElseIf cbNmBgn.SelectedItem = "Jajar Genjang" Then
                Dim Ljg As New rumus
                Ljg.Luas_JajarGnjng()
            ElseIf cbNmBgn.SelectedItem = "Layang-layang" Then
                Dim Llayang2 As New rumus
                Llayang2.Luas_Layang2()
            ElseIf cbNmBgn.SelectedItem = "Belah Ketupat" Then
                Dim LBlhKtpt As New rumus
                LBlhKtpt.Luas_BelahKetupat()
            ElseIf cbNmBgn.SelectedItem = "Kubus" Then
                Dim Lkubus As New rumus
                Lkubus.Luas_Kubus()
            ElseIf cbNmBgn.SelectedItem = "Balok" Then
                Dim LBalok As New rumus
                LBalok.Luas_Balok()
            ElseIf cbNmBgn.SelectedItem = "Prisma" Then
                Dim LPrisma As New rumus
                LPrisma.Luas_PrismaSegi3()
            ElseIf cbNmBgn.SelectedItem = "Limas" Then
                Dim LLimas As New rumus
                LLimas.Luas_LimasSegi3()
            ElseIf cbNmBgn.SelectedItem = "Bola" Then
                Dim LBola As New rumus
                LBola.Luas_Bola()
            ElseIf cbNmBgn.SelectedItem = "Tabung / Silinder" Then
                Dim LTabung As New rumus
                LTabung.Luas_Tabung()
            ElseIf cbNmBgn.SelectedItem = "Kerucut" Then
                Dim LKerucut As New rumus
                LKerucut.Luas_Kerucut()
            End If
        ElseIf cbProses.SelectedItem = "Keliling" Then
            If cbNmBgn.SelectedItem = "Persegi" Then
                Dim Kpersegi As New rumus
                Kpersegi.Keliling_Persegi()
            ElseIf cbNmBgn.SelectedItem = "Persegi Panjang" Then
                Dim Kpersegipnjng As New rumus
                Kpersegipnjng.Keliling_PersegiPnjng()
            ElseIf cbNmBgn.SelectedItem = "Segitiga" Then
                Dim Ksegitiga As New rumus
                Ksegitiga.Keliling_Segitiga()
            ElseIf cbNmBgn.SelectedItem = "Lingkaran" Then
                Dim Klingkaran As New rumus
                Klingkaran.Keliling_Lingkaran()
            ElseIf cbNmBgn.SelectedItem = "Trapesium" Then
                Dim Ktrapesium As New rumus
                Ktrapesium.Keliling_Trapesium()
            ElseIf cbNmBgn.SelectedItem = "Jajar Genjang" Then
                Dim Kjg As New rumus
                Kjg.Keliling_JajarGnjng()
            ElseIf cbNmBgn.SelectedItem = "Layang-layang" Then
                Dim KLayang2 As New rumus
                KLayang2.Keliling_Layang2()
                'ElseIf cbNmBgn.SelectedItem = "Layang-layang" Then
                '    Dim Klayang2 As New rumus
                '    Klayang2.Keliling_Layang2()
            ElseIf cbNmBgn.SelectedItem = "Belah Ketupat" Then
                Dim KBlhKtpt As New rumus
                KBlhKtpt.Keliling_BelahKetupat()
            ElseIf cbNmBgn.SelectedItem = "Kubus" Then
                Dim Kkubus As New rumus
                Kkubus.Keliling_Kubus()
            ElseIf cbNmBgn.SelectedItem = "Balok" Then
                Dim KBalok As New rumus
                KBalok.Keliling_Balok()
            ElseIf cbNmBgn.SelectedItem = "Prisma" Then
                Dim KPrisma As New rumus
                KPrisma.Keliling_PrismaSegi3()
            ElseIf cbNmBgn.SelectedItem = "Limas" Then
                Dim KLimas As New rumus
                KLimas.Keliling_LimasSegi3()
            ElseIf cbNmBgn.SelectedItem = "Bola" Then
                Dim KBola As New rumus
                KBola.Keliling_Bola()
            ElseIf cbNmBgn.SelectedItem = "Tabung / Silinder" Then
                Dim KTabung As New rumus
                KTabung.Keliling_Tabung()
            ElseIf cbNmBgn.SelectedItem = "Kerucut" Then
                Dim KKerucut As New rumus
                KKerucut.Keliling_Kerucut()
            End If
        ElseIf cbProses.SelectedItem = "Volume" Then
            If cbNmBgn.SelectedItem = "Kubus" Then
                Dim Vkubus As New rumus
                Vkubus.Volume_Kubus()
            ElseIf cbNmBgn.SelectedItem = "Balok" Then
                Dim VBalok As New rumus
                VBalok.Volume_Balok()
            ElseIf cbNmBgn.SelectedItem = "Prisma" Then
                Dim VPrisma As New rumus
                VPrisma.Volume_PrismaSegi3()
            ElseIf cbNmBgn.SelectedItem = "Limas" Then
                Dim VLimas As New rumus
                VLimas.Volume_LimasSegi3()
            ElseIf cbNmBgn.SelectedItem = "Bola" Then
                Dim VBola As New rumus
                VBola.Volume_Bola()
            ElseIf cbNmBgn.SelectedItem = "Tabung / Silinder" Then
                Dim VTabung As New rumus
                VTabung.Volume_Tabung()
            ElseIf cbNmBgn.SelectedItem = "Kerucut" Then
                Dim VKerucut As New rumus
                VKerucut.Volume_Kerucut()
            End If
        End If
        If cbProses.SelectedItem = "" Then
            MsgBox("Silahkan pilih proses pengerjaan")
        ElseIf cbNmBgn.SelectedItem = "" Then
            MsgBox("Silahkan pilih bangun pengerjaan")
        End If
        'Call clear()
    End Sub
    Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
        Me.Close()
    End Sub
    Private Sub rbDatar_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbDatar.CheckedChanged
        If rbDatar.Checked = True Then
            cbProses.Items.Add("Luas")
            cbProses.Items.Add("Keliling")
            cbNmBgn.Items.Add("Persegi")
            cbNmBgn.Items.Add("Persegi Panjang")
            cbNmBgn.Items.Add("Segitiga")
            cbNmBgn.Items.Add("Lingkaran")
            cbNmBgn.Items.Add("Trapesium")
            cbNmBgn.Items.Add("Jajar Genjang")
            cbNmBgn.Items.Add("Layang-layang")
            cbNmBgn.Items.Add("Belah Ketupat")
        ElseIf rbDatar.Checked = False Then
            Call clear()
        End If
    End Sub
    Private Sub rbRuang_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbRuang.CheckedChanged
        If rbRuang.Checked = True Then
            cbProses.Items.Add("Volume")
            cbProses.Items.Add("Luas")
            cbProses.Items.Add("Keliling")
            cbNmBgn.Items.Add("Kubus")
            cbNmBgn.Items.Add("Balok")
            cbNmBgn.Items.Add("Prisma")
            cbNmBgn.Items.Add("Limas")
            cbNmBgn.Items.Add("Bola")
            cbNmBgn.Items.Add("Tabung / Silinder")
            cbNmBgn.Items.Add("Kerucut")
        ElseIf rbRuang.Checked = False Then
            Call clear()
        End If
    End Sub
End Class

Tidak ada komentar:

Posting Komentar