Get me outta here!

Selasa, 03 Januari 2017

Struk pembayaran barang menggunakan aplikasi VB,NET

Yak kali ini saya akan membuat struk pembayaran menggunakan aplikasi VB.NET, berikutlah
langkah-langkahnya,

1. Buka aplikasi VB.NET

2. Buat desain seperti dibawah ini, desain1/ form1 untuk login dan form2 untuk struk pembayaran


Design 1

 
Design 2
 
 

3. Jika sudah masukkan kodingan seperti dibawah ini

form 1:

Public Class Form1

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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim franak As New frmstruk


        If (TextBox1.Text = "husna") And (TextBox2.Text = "12345678") Then
            franak.Show()

        End If
    End Sub
End Class

form 2:

Public Class frmstruk

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

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim tbyr As Integer
        Dim thrg As Integer
        Dim pjk As Integer
        pjk = TextBox7.Text
        thrg = TextBox3.Text
        tbyr = thrg - pjk
        TextBox4.Text = tbyr

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        TextBox1.Text = ""
        TextBox2.Text = ""
        TextBox3.Text = ""
        TextBox4.Text = ""
        TextBox5.Text = ""
        TextBox6.Text = ""
        TextBox7.Text = ""
        ComboBox1.Text = ""
        RadioButton1.Checked = False
        RadioButton2.Checked = False

    End Sub

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

    End Sub

    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked Then
            TextBox7.Text = 0.1 * TextBox3.Text
        End If
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked Then
            TextBox7.Text = 0 * TextBox3.Text
        End If
    End Sub

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        If ComboBox1.Text = "SFD" Then TextBox5.Text = "SOFT DRINK"
        If ComboBox1.Text = "SNK" Then TextBox5.Text = "SNACK"
        If ComboBox1.Text = "SBK" Then TextBox5.Text = "SEMBAKO"
        If ComboBox1.Text = "SKM" Then TextBox5.Text = "COSMETIK"
        If ComboBox1.Text = "SFD" Then TextBox2.Text = "25000"
        If ComboBox1.Text = "SNK" Then TextBox2.Text = "15000"
        If ComboBox1.Text = "SBK" Then TextBox2.Text = "75000"
        If ComboBox1.Text = "SKM" Then TextBox2.Text = "100000"
    End Sub

    Private Sub TextBox6_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox6.TextChanged
        Dim harga As Integer
        Dim jumlah As Integer
        Val(harga = TextBox2.Text)
        Val(jumlah = TextBox6.Text)
        TextBox3.Text = TextBox2.Text * TextBox6.Text
    End Sub
End Class

4. Jika sudah maka RUN program tersebut






Yak begitulah caranya, semoga bermanfaat bagi pembaca sekalian . terimakasih^^

0 komentar:

Posting Komentar