Posted by : HD Technology Studio Rabu, 18 Mei 2016

.Langkah 1 : membuat desain form
Buat form baru dengan cara klik file – new – project – windows form application
Buatlah desain form seperti gambar diatas
Komponen yang dibutuhkan adalah 1 buah picturebox, 3 buah button, 13 label, 1 buah groupbox, 12 buah radiobutton, 12 buah textbox
Nb : pada gambar diatas ada dua operasi untuk menghitung panjang dg yaitu dg dan dg 2. Yang perlu diketahui adalah operasi panjang dg digunakan jika yang dii tanyakan panjang dg dan yang diketahui adalah panjang cd dan panjang cg sementara operasi panjang dg 2 digunakan jika ditanyakan panjang dg sementara yang diketahui adalah panjang de dan panjang eg.
Langkah 2 : ,memberi nilai pada masing2 komponen
Klik pada komponen yang akan diberi nilai kemudian masukkan nilai berikut pada properti komponen.

Langkah 3 : listing code

Klik view – code atau shortcut F7 untuk memulai memasukkan kode

Masukkan kode seperti dibawah ini


Public Class Form1

    Public operasi As Byte

    Public diagonal1 As Double

    Public diagonal2 As Double

    Public luas As Double

    Public keliling As Double

    Public hasila As Double

    Public hasilb As Double

    Public hasilc As Double

    Public akhir As Double

    Private Sub btnexit_Click(sender As Object, e As EventArgs) Handles btnexit.Click

        Me.Close()

    End Sub


    Private Sub btnhitung_Click(sender As Object, e As EventArgs) Handles btnhitung.Click

        If operasi = "1" Then

            luas = txtd1.Text * txtd2.Text * 1 / 2

            txtluas.Text = luas

        ElseIf operasi = "2" Then

            hasila = Double.Parse(txtcd.Text) + Double.Parse(txtde.Text)

            keliling = 2 * (hasila)

            txtkeliling.Text = keliling

        ElseIf operasi = "3" Then

            hasila = 1 / 2 * Double.Parse(txtd2.Text)

            diagonal1 = Double.Parse(txtluas.Text) / (hasila)

            txtd1.Text = diagonal1

        ElseIf operasi = "4" Then

            hasila = txtcg.Text ^ 2

            hasilb = txtdg.Text ^ 2

            hasilc = hasilb + hasila

            akhir = Math.Sqrt((hasilc))

            txtcd.Text = akhir

        ElseIf operasi = "5" Then

            hasila = txtcd.Text ^ 2

            hasilb = txtcg.Text ^ 2

            hasilc = hasila - hasilb

            akhir = Math.Sqrt((hasilc))

            txtdg.Text = akhir

        ElseIf operasi = "6" Then

            hasila = txtcd.Text ^ 2

            hasilb = txtdg.Text ^ 2

            hasilc = hasila - hasilb

            akhir = Math.Sqrt((akhir))

            txtcg.Text = akhir

        ElseIf operasi = "7" Then

            hasila = 1 / 2 * Double.Parse(txtd1.Text)

            diagonal2 = Double.Parse(txtluas.Text) / (hasila)

            txtd2.Text = diagonal2

        ElseIf operasi = "8" Then

            hasila = Double.Parse(txtdg.Text) ^ 2

            hasilb = Double.Parse(txteg.Text) ^ 2

            hasilc = hasila + hasilb

            akhir = Math.Sqrt((hasilc))

            txtde.Text = akhir

        ElseIf operasi = "9" Then

            hasila = Double.Parse(txtde.Text) ^ 2

            hasilb = Double.Parse(txtdg.Text) ^ 2

            hasilc = hasila - hasilb

            akhir = Math.Sqrt((akhir))

        ElseIf operasi = "10" Then

            hasila = Double.Parse(txtcg.Text) + Double.Parse(txteg.Text)

            txtce.Text = hasila

        ElseIf operasi = "11" Then

            hasila = Double.Parse(txtdg.Text) + Double.Parse(Label14.Text)

            txtdf.Text = hasila

        ElseIf operasi = "12" Then

            hasila = Double.Parse(txtde.Text) ^ 2

            hasilb = Double.Parse(txteg.Text) ^ 2

            hasilc = hasila - hasilb

            akhir = Math.Sqrt((hasilc))

            txtdg.Text = akhir

        End If

    End Sub


    Private Sub rbluas_Click(sender As Object, e As EventArgs) Handles rbluas.Click

        operasi = 1

    End Sub


    Private Sub rbkeliling_Click(sender As Object, e As EventArgs) Handles rbkeliling.Click

        operasi = 2

    End Sub


    Private Sub rbd1_Click(sender As Object, e As EventArgs) Handles rbd1.Click

        operasi = 3

    End Sub


    Private Sub rbcd_Click(sender As Object, e As EventArgs) Handles rbcd.Click

        operasi = 4

    End Sub


    Private Sub rbdg_Click(sender As Object, e As EventArgs) Handles rbdg.Click

        operasi = 5

    End Sub


    Private Sub rbcg_Click(sender As Object, e As EventArgs) Handles rbcg.Click

        operasi = 6

    End Sub


    Private Sub rbd2_Click(sender As Object, e As EventArgs) Handles rbd2.Click

        operasi = 7

    End Sub


    Private Sub rbde_Click(sender As Object, e As EventArgs) Handles rbde.Click

        operasi = 8

    End Sub


    Private Sub rbeg_Click(sender As Object, e As EventArgs) Handles rbeg.Click

        operasi = 9

    End Sub


    Private Sub rbce_Click(sender As Object, e As EventArgs) Handles rbce.Click

        operasi = 10

    End Sub


    Private Sub rbdf_Click(sender As Object, e As EventArgs) Handles rbdf.Click

        operasi = 11

    End Sub


    Private Sub btnclear_Click(sender As Object, e As EventArgs) Handles btnclear.Click

        txtcd.Text = ""

        txtce.Text = ""

        txtcg.Text = ""

        txtd1.Text = ""

        txtd2.Text = ""

        txtde.Text = ""

        txtdf.Text = ""

        txtdg.Text = ""

        txteg.Text = ""

        txtfg.Text = ""

        txtkeliling.Text = ""

        txtluas.Text = ""

    End Sub


    Private Sub rbdg2_Click(sender As Object, e As EventArgs) Handles rbdg2.Click

        operasi = 12

    End Sub

End Class

Langkah 4 : Debugging

Jika semua langkah – langkah telah dilakuukan maka selanjutnya adalah proses debugging. Untuk memullai nya klik Debug – start debugging atau dengan shortcut F5 jika tidak ada masalah maka software akan berjalan seperti gambar diatas.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Welcome to My Blog

Translate

Popular Post

Flag Counter

- Copyright © HD Technology Studio -Robotic Notes- Powered by Blogger - Designed by Johanes Djogan -