Jumat, 09 Januari 2015

[Tugas Pemrograman Visual] Memasukkan Gambar Pada Form Project VB.Net

Postingan ini adalah tugas terakhir yang diberikan oleh dosen saya di akhir semester ini. Ingat ya, akhir semester lho bukan akhir dari segalanya *hmm. Langsung ikuti design form-nya gaes..........

 Berikut listing programnya :))))))))))))

Public Class Form1
    Sub BuatTabel()
        With LV
            .Columns.Add("Kode", 60, HorizontalAlignment.Center)
            .Columns.Add("Nama", 200, HorizontalAlignment.Left)
            .Columns.Add("Harga", 50, HorizontalAlignment.Right)
            .Columns.Add("Jumlah", 60, HorizontalAlignment.Right)
            .Columns.Add("Total Harga", 60, HorizontalAlignment.Right)
            .View = View.Details
            .GridLines = True
            .FullRowSelect = True
        End With
    End Sub
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For i = 1 To 3
            Jumlah.Items.Add(i)
        Next
        For i = 1 To 9
            Kode.Items.Add("P00" & i)
        Next
        Call BuatTabel()
    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        Select Case Kode.Text
            Case "P001"
                Nama.Text = "Televisi"
                Harga.Text = 2900000
            Case "P002"
                Nama.Text = "DVD Sony"
                Harga.Text = 900000
            Case "P002"
                Nama.Text = "Notebook"
                Harga.Text = 4900000
            Case "P003"
                Nama.Text = "CD RW"
                Harga.Text = 290000
            Case "P007"
                Nama.Text = "CD BLANK"
                Harga.Text = 29000
            Case Else
                Nama.Text = ""
                Harga.Text = 0
        End Select
        Try
            gambar.Image = Image.FromFile("D:" & kode.Text & ".jpg")
        Catch err As Exception
            Gambar.Image = Nothing
        End Try
    End Sub

    Private Sub Jumlah_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah.SelectedIndexChanged
        totharga.Text = harga.Text * jumlah.Text
    End Sub

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

    Private Sub Batal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles batal.Click
        kode.Text = ""
        nama.Text = ""
        harga.Text = ""
        totharga.Text = ""
        jumlah.Text = ""
    End Sub

    Private Sub isi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles isi.Click
        Dim lst As New ListViewItem
        lst.Text = kode.Text
        lst.SubItems.Add(nama.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jumlah.Text)
        lst.SubItems.Add(totharga.Text)
        LV.Items.Add(lst)
    End Sub

    Private Sub Hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
        LV.Items.Clear()
    End Sub

    Private Sub Hapusbrg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapusbrg.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub
End Class

Hasilnya adalah seperti gambar yang ada di bawah ini:



Read More




[Tugas Pemrograman Visual] Program Pemesanan Kamar Hotel Menggunakan VB.Net

Selamat pagi gaes.........

Kali ini saya akan memosting program terbaru yang telah saya coba. Sesuai dengan judul postingannya, saya juga akan memberikan source code-nya secara gratissssss.

 Ikuti coding berikut:

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tipe.Items.Add("Ekonomi")
        tipe.Items.Add("VIP")
    End Sub

    Private Sub tipe_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tipe.SelectedIndexChanged
        If tipe.Text = "Ekonomi" Then
            nomor.Items.Add("1/EKO-B")
            nomor.Items.Add("2/EKO-M")
            nomor.Items.Add("3/EKO-A")
        ElseIf tipe.Text = "VIP" Then
            nomor.Items.Add("1/VIP-B")
            nomor.Items.Add("2/VIP-M")
            nomor.Items.Add("3/VIP-A")
        End If

    End Sub

    Private Sub nomor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nomor.SelectedIndexChanged
        Dim x, y, z As String

        'Nama Kamar
        x = Microsoft.VisualBasic.Right(nomor.Text, 1)
        If x = "B" Then
            nama.Text = "Naruto"
        ElseIf x = "M" Then
            nama.Text = "Avatar"
        ElseIf x = "A" Then
            nama.Text = "Inuyasha"
        End If

        'Kode Kunci
        y = Microsoft.VisualBasic.Left(nomor.Text, 1)
        z = Microsoft.VisualBasic.Mid(nomor.Text, 3, 3)
        kode.Text = "Kunci/" & y & "-" & z & "/" & x

        'Sewa
        If tipe.Text = "Ekonomi" Then
            sewa.Text = 10000000
        ElseIf tipe.Text = "VIP" Then
            sewa.Text = 20000000
        End If

        'Fasilitas
        If tipe.Text = "Ekonomi" And x = "B" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Lemari")
        ElseIf tipe.Text = "Ekonomi" And x = "M" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Lemari")
        ElseIf tipe.Text = "Ekonomi" And x = "A" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Lemari")
        ElseIf tipe.Text = "VIP" And x = "B" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Lemari")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Karaoke Keluarga")
        ElseIf tipe.Text = "VIP" And x = "M" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Lemari")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Karaoke Keluarga")
        ElseIf tipe.Text = "VIP" And x = "A" Then
            fasilitas.Items.Add("Tempat Tidur")
            fasilitas.Items.Add("Lemari")
            fasilitas.Items.Add("Kamar Mandi")
            fasilitas.Items.Add("Karaoke Keluarga")
        End If

    End Sub

    Private Sub fasilitas_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles fasilitas.SelectedIndexChanged
        'Harga Fasilitas
        If tipe.Text = "Ekonomi" And fasilitas.Text = "Tempat Tidur" Then
            harga.Text = 200000
        ElseIf tipe.Text = "Ekonomi" And fasilitas.Text = "Kamar Mandi" Then
            harga.Text = 250000
        ElseIf tipe.Text = "Ekonomi" And fasilitas.Text = "Lemari" Then
            harga.Text = 150000
        ElseIf tipe.Text = "VIP" And fasilitas.Text = "Tempat Tidur" Then
            harga.Text = 900000
        ElseIf tipe.Text = "VIP" And fasilitas.Text = "Kamar Mandi" Then
            harga.Text = 850000
        ElseIf tipe.Text = "VIP" And fasilitas.Text = "Lemari" Then
            harga.Text = 550000
        ElseIf tipe.Text = "VIP" And fasilitas.Text = "Karaoke Keluarga" Then
            harga.Text = 750000
        End If

        'Daftar dan Harga Fasilitas
        ListBox1.Items.Add(fasilitas.Text & "  RP." & harga.Text)

        'Total Harga Fasilitas
        totfasilitas.Text = Val(totfasilitas.Text) + Val(harga.Text)
    End Sub

    Private Sub lama_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles lama_inap.KeyPress

        'Diskon
        If e.KeyChar = Chr(13) Then
            If lama_inap.Text >= 5 Then
                diskon.Text = 0.02 * Val(lama_inap.Text * sewa.Text) + Val(totfasilitas.Text)
            ElseIf lama_inap.Text >= 2 Then
                diskon.Text = 0.01 * Val(lama_inap.Text * sewa.Text) + Val(totfasilitas.Text)
            Else
                diskon.Text = 0
            End If

            'Total Bayar
            totbayar.Text = Val(lama_inap.Text * sewa.Text) + Val(totfasilitas.Text) - Val(diskon.Text)
        End If

    End Sub

    Private Sub pembayaran_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles pembayaran.KeyPress
        If e.KeyChar = Chr(13) Then
            kembalian.Text = Val(pembayaran.Text - totbayar.Text)
        End If

    End Sub

    Private Sub bersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bersih.Click
        tipe.Text = ""
        nomor.Text = ""
        nama.Text = ""
        kode.Text = ""
        sewa.Text = ""
        fasilitas.Text = ""
        harga.Text = ""
        lama_inap.Text = ""
        diskon.Text = ""
        totbayar.Text = ""
        pembayaran.Text = ""
        kembalian.Text = ""
        ListBox1.Items.Clear()
        totfasilitas.Text = ""

    End Sub

    Private Sub keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles keluar.Click
        Me.Close()
    End Sub
End Class


Gambar program ketika dijalankan:


Read More




[Tugas Pemrograman Visual] Membuat Form Login Pada VB.Net

Kagak pake basa-basi, Gan. Mari kita sikat ilmu dari saya yang tak seberapa ini.

 Sing iki listing programe yoo...



Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        ProgressBar1.Value = ProgressBar1.Value + 1
        If ProgressBar1.Value = 100 Then
            Timer1.Stop()
            Form1.Show()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Username.Text = "Igaph" And Password.Text = "1234" Then
            Timer1.Start()
        Else
            MsgBox("Username dan password Anda Salah")
            Username.Text = ""
            Password.Text = ""
        End If
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim q As Integer
        q = MsgBox("Apakah Anda ingin Keluar ?", MsgBoxStyle.Question + MsgBoxStyle.YesNo, "Absensi Karyawan")
        If q = vbYes Then
            Close()
        End If
    End Sub

    Private Sub Password_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Password.KeyPress
        Dim t As Integer = Asc(e.KeyChar)
        If t = 13 Then
            If Username.Text = "Sari" And Password.Text = "1234" Then
                Timer1.Start()
            Else
                MsgBox("Username dan password Anda Salah")
                Username.Text = ""
                Password.Text = ""
            End If
        End If
    End Sub


 Ketika kita klik button Logoff maka akan muncul kotak dialog seperti ini:

Selamat menikmati ilmu yang diperoleh.
Read More




[Tugas Pemrograman Visual] Kriptografi Caesar Pada VB.Net


Metode Caesar seperti yang kita ketahui adalah salah satu teknik enkripsipaling sederhana dan paling terkenal. Sandi ini termasuk sandi substitusi di mana setiap huruf pada teks terang (plaintext) digantikan oleh huruf lain yang memiliki selisih posisi tertentu dalam alfabet. Misalnya, jika menggunakan geseran 3, W akan menjadi Z, I menjadi L, dan K menjadi N sehingga teks terang "wiki" akan menjadi "ZLNL" pada teks tersandi. Nama Caesar diambil dari Julius Caesar, jenderal, konsul, dan diktator Romawi yang menggunakan sandi ini untuk berkomunikasi dengan para panglimanya. Berikut contoh program Metode Kriptografi Caesar Menggunakan VB.Net 2008.

 Berikut listing programnya:



Private Sub BtnEnkripsi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim teks As String = ""
Dim i As Integer
Dim xkar As String = ""

For i = 1 To Len(Plaintext.Text)
xkar = Mid(Plaintext.Text, i, 1)
xkar = Chr(Asc(xkar) + 3)
teks = teks + xkar

Next

Chipertext.Text = teks
Plaintext.Text = ""

 End Sub

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

Dim teks As String = ""
Dim i As Integer
Dim xkar As String = ""

For i = 1 To Len(Chipertext.Text)
xkar = Mid(Chipertext.Text, i, 1)
xkar = Chr(Asc(xkar) - 3)
teks = teks + xkar

Next

 Plaintext.Text = teks
Chipertext.Text = ""
 
End Sub



Maka hasil program akan seperti ini ketika dijalankan. Selamat mencoba.


Read More




Return to top of page
Powered By Blogger | Design by Genesis Awesome | Blogger Template by Lord HTML