PANCAKARYA PKK

Karina Margaretha Sumianto
XI RPL

ingin menjelaskan mengenai visual basic membuat pendaftaran, loogin dan proses penjualan.

Jadi, ini adalah tampil desain dr form pendaftaran yang sberisi nama, username, serta password. jika sudah mengisi, pencet daftar agar data tersebut dapat masuk ke database.



dengan source spt :
Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub reset_Click(sender As Object, e As EventArgs) Handles reset.Click
        Textnamalengkap.ResetText()
        Textusername.ResetText()
        Textpass.ResetText()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim con As SqlConnection = New SqlConnection("Data Source=NETI_AM\SQLEXPRESS;Initial Catalog=pkk;Integrated Security=True")
        Dim cmd As SqlCommand = New SqlCommand("insert into Pendaftaran values ('" + Textnamalengkap.Text + "','" + Textusername.Text + "','" + Textpass.Text + "')", con)
        Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
        Dim dt As DataTable = New DataTable()
        sda.Fill(dt)
        MessageBox.Show("Anda Berhasil Mendaftar", "information", MessageBoxButtons.OK, MessageBoxIcon.Information)
    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Me.Hide()
        Form2.Show()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs)
        Me.Close()
    End Sub

setelah melakukan pendaftaran, langsung ke tampilan login


dengan source :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim con As SqlConnection = New SqlConnection("Data Source=NETI_AM\SQLEXPRESS;Initial Catalog=pkk;Integrated Security=True")
        Dim cmd As SqlCommand = New SqlCommand("select* from Pendaftaran where User_Nama='" + Textnama.Text + "' and password='" + Textpass.Text + "'", con)
        Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
        Dim dt As DataTable = New DataTable()
        sda.Fill(dt)
        If (dt.Rows.Count > 0) Then
            MessageBox.Show("Anda Berhasil Login", "information", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Me.Hide()
            Form3.Show()
        ElseIf Textnama.Text = "" And Textpass.Text = "" Then
            MessageBox.Show("Data belum ada", "information", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            MessageBox.Show("Akun tidak ditemukan", "information", MessageBoxButtons.OK, MessageBoxIcon.Information)
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Hide()
        Form1.Show()
    End Sub

lalu akan masuk ke tampilan menu dan berapa porsi yg ingin kita pesan.

dengan source :
Sub hitung()
        Dim udukmoz As Int32 = Convert.ToInt32(TextBox1.Text) * 10
        Dim udukbakar As Int32 = Convert.ToInt32(TextBox2.Text) * 10
        Dim escampur As Int32 = Convert.ToInt32(TextBox3.Text) * 10
        Dim birpletok As Int32 = Convert.ToInt32(TextBox4.Text) * 8
        TextBox5.Text = CStr(udukmoz + udukbakar + birpletok + escampur) + "000"

    End Sub
    Private Sub Form3_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    End Sub

    Private Sub reset_Click(sender As Object, e As EventArgs) Handles reset.Click
        MessageBox.Show("Pesanan anda terkonfirmasi", "Terkonfirmasi", MessageBoxButtons.OK, MessageBoxIcon.Information)

        product_countmoz = TextBox1.Text
        product_countkar = TextBox2.Text
        product_countcam = TextBox3.Text
        product_counttok = TextBox4.Text

        product_ttl = TextBox5.Text
        Me.Hide()
        Form5.Show()

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        hitung()

    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        TextBox5.Text = String.Empty
        TextBox1.Text = String.Empty
        TextBox2.Text = String.Empty
        TextBox3.Text = String.Empty
        TextBox4.Text = String.Empty
    End Sub


setelah itu, akan masuk ke tampilan selanjutnya yg dimana akan mentotalkan pesanan.

dengan source :
Private Sub Form5_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.Text = product_countmoz
    End Sub

    Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
        TextBox2.Text = product_countkar
    End Sub

    Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
        TextBox3.Text = product_countcam
    End Sub

    Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
        TextBox4.Text = product_counttok
    End Sub

    Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
        TextBox5.Text = product_ttl
    End Sub

    Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click


    End Sub

    Private Sub reset_Click(sender As Object, e As EventArgs) Handles reset.Click
        Me.Hide()
        Form4.Show()
    End Sub
End Class

Dan akhirnya, setelah sudah mengetik tombol 'Done' nanti akan muncul tampilan terima kasih.






Komentar