You are on page 1of 19

LAPORAN PRAKTIKUM

PEMROGRAMAN VB

Nama : Farid Ahmad Safii


Npm : 16410014

PROGRAM DIII SISTEM INFORMASI FAKULTAS ILMU KOMPUTER

UNIVERSITAS MUHAMMADIYAH METRO

TAHUN AKADEMIK 2018/2019


Kata Pengantar

Alhamdulillah Puji dan Syukur penulis ucapkan atas hadirat Allah Swt, zat Yang
Maha Indah dengan segala keindahan-Nya. Alhamdulillah berkat Rahmat dan Hidayah-Nya
kami dapat menyelesaikan laporan Praktikum mata kuliah Basis Data

Akhirnya dengan segala kerendahan hati izinkanlah penulis untuk menyampaikan


terima kasih dan penghargaan yang setinggi-tingginya kepada semua pihak yang telah
berjasa memberikan motivasi dalam rangka menyelesaikan laporan tugas akhir ini.

Penulis juga mengucapkan terima kasih kepada semua pihak yang terkait, yang telah
membantu dalam menyelesaikan laporan praktikum ini. Semoga kebaikan yang diberikan
oleh semua pihak menjadi amal yang senantiasa mendapat balasan dan kebaikan yang
berlipat ganda dari Allah Subhana wa Ta’ala.
Amin.

Akhir kata, penulis menyadari bahwa masih terdapat kekurangan dalam laporan
tugas ini, untuk itu saran dan kritik yang sifatnya membangun sangat kami harapkan.

Pembuat

Farid Ahmad Safii


MODUL II
1. Identitas

FORM 1
Property Caption Name
Label1 Nama Label1
Label2 NPM Label2
Label3 Alamat Label3
Label4 No. Tlp Label4
Text1 Text1
Text2 Text2
Text3 Text3
Text4 Text4
Command1 Proses Command1

FORM 2
Property Caption Name
Frame1 Identitas Frame1
Label1 Nama Label1
Label2 NPM Label2
Label3 Alamat Label3
Label4 No. Tlp Label4
Label5 : Label5
Label6 : Label6
Label7 : Label7
Label8 : Label8
Label9 Label9
Label10 Label10
Label11 Label11
Label12 Label12
Private Sub Command1_Click()
Form2.Show
Form2.Label9.Caption = Text1.Text
Form2.Label10.Caption = Text2.Text
Form2.Label11.Caption = Text3.Text
Form2.Label12.Caption = Text4.Text
End Sub

2. Kalkulator

FORM 1
Property Caption Name
Label1 Bilangan Pertama Label1
Label2 Bilangan Kedua Label2
Label3 Hasil Label3
Text1 Text1
Text2 Text2
Text3 Text3
Command1 + Command1
Command2 - Command2
Command3 * Command3
Command4 / Command4

Private Sub Command1_Click()


Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub

Private Sub Command2_Click()


Text3.Text = Val(Text1.Text) - Val(Text2.Text)
End Sub

Private Sub Command3_Click()


Text3.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub

Private Sub Command4_Click()


Text3.Text = Val(Text1.Text) / Val(Text2.Text)
End Sub

3. Luas kubus, persegi panjang, lingkaran

FORM 1
Property Caption Name
Frame1 Kubus Frame1
Frame2 Persegi Panjang Frame2
Frame3 Lingkaran Frame3
Label1 Sisi Label1
Label2 Panjang Label2
Label3 Luas Label3
Label4 Luas Label4
Label5 Lebar Label5
Label6 Panjang Label6
Label7 Lebar Label7
Label8 luas Label8
Text1 Text1
Text2 Text2
Text3 Text3
Text4 Text4
Text5 Text5
Text6 Text6
Text7 Text7
Text8 Text8
Command1 Hitung Command1
Command2 Hitung Command2
Command3 Hitung Command3
Command4 Luas Kubus Command4
Command5 Luas Persegi Panjang Command5
Command6 Lingkaran Command6
Command7 Out Command7
Tumpuk semua frame, contoh seperti gambar dibawah

Private Sub Command1_Click()


Text2.Text = Text1.Text * Text1.Text * Text1.Text
End Sub

Private Sub Command2_Click()


Text4.Text = Val(Text6.Text) * Val(Text5.Text)
End Sub

Private Sub Command3_Click()


Dim x As Double
x = 3.14
Text8.Text = Text7.Text * Text3.Text * x
End Sub

Private Sub Command4_Click()


Frame1.Visible = True
If ((Frame2.Visible = True) Or (Frame3.Visible = True)) Then
Frame1.Visible = True
Frame2.Visible = False
Frame3.Visible = False
End If
End Sub

Private Sub Command5_Click()


Frame2.Visible = True
If ((Frame1.Visible = True) Or (Frame3.Visible = True)) Then
Frame1.Visible = False
Frame2.Visible = True
Frame3.Visible = False
End If
End Sub

Private Sub Command6_Click()


Frame3.Visible = True
If ((Frame1.Visible = True) Or (Frame2.Visible = True)) Then
Frame1.Visible = False
Frame2.Visible = False
Frame3.Visible = True
End If
End Sub

Private Sub Command7_Click()


Unload Me
End Sub
MODUL III
1. Confirm Passowrd

FORM 1
Property Caption Name
Label1 Nama Label1
Label2 Password Label2
Label3 Confirm Password Label3
Text1 Text1
Text2 Text2
Text3 Text3
Command1 Check Password Command1

Private Sub Command1_Click()


If ((Text2.Text = "") And (Text3.Text = "")) Then
MsgBox "Error type in field password or confirm password", vbCritical, "Confirmation"
ElseIf Text3.Text = Text2.Text Then
MsgBox "Password received", vbInformation, "Confirmation"
MsgBox "Thank you for using this program", vbInformation, "Confirmation"
Unload Me
Else
MsgBox "Error type in field password or confirm password", vbCritical, "Confirmation"
End If
End Sub
2. Menghitung Nilai Akhir Mahasiswa

Object Properties Value


Form1 Caption <judul program>
Label1 Caption NPM
Label2 Caption Nama Mahasiswa
Label3 Caption Tugas
Label4 Caption QUIS
Label5 Caption UTS
Label6 Caption UAS
Label7 Caption Nilai Angka
Label8 Caption Nilai Mutu
Label9 Caption Keterangan Kalimat
Combobox1 Text <kosong>
Textbox1 Text <kosong>
Textbox2 Text <kosong>
Textbox3 Text <kosong>
Textbox4 Text <kosong>
Textbox5 Text <kosong>
Textbox6 Text <kosong>
Textbox7 Text <kosong>
Textbox8 Text <kosong>
Commandbutton1 Caption HITUNG
Commandbutton2 Caption CLEAR
Commandbutton3 Caption KELUAR
3. Tiket Travel

FORM 1
Property Caption Name
Label1 Kelas Label1
Label2 Tujuan Label2
Label3 Label3
Label4 Tiket Label4
Label5 Label5
Label6 Label6
Label7 Label7
Option1 Biasa biasa
Option2 Luar Biasa luarbiasa
Combobox Pilih Tujuan Combo1
Text1 btiket
Command1 Proses Command1
Frame1 Harga dan Ketentuan
Frame2 Banyak tiket yang dipesan
Frame3 Informasi Pesanan
Frame4 Total Bayar
Timer1 Timer1
Progressbar Progressbar1
Private Sub biasa_Click()
Combo1.Clear
Combo1.Text = "Pilih Tujuan"
Label3.Caption = ""
If biasa.Value = True Then
Combo1.AddItem "Jakarta"
Combo1.AddItem "Yogyakarta"
Combo1.AddItem "Bali"
End If
End Sub

Private Sub Combo1_Click()


If ((biasa.Value = True) And (Combo1.Text = "Jakarta")) Then
Label3.Caption = "Batas minimal 50 Orang" & vbNewLine & "Discount 25% untuk 50
orang ++" & vbNewLine & vbNewLine & "Rp. 10.000"
ElseIf ((biasa.Value = True) And (Combo1.Text = "Yogyakarta")) Then
Label3.Caption = "Batas minimal 40 Orang" & vbNewLine & "Discount 25% untuk 40
orang ++" & vbNewLine & vbNewLine & "Rp. 25.000"
ElseIf ((biasa.Value = True) And (Combo1.Text = "Bali")) Then
Label3.Caption = "Batas minimal 30 Orang" & vbNewLine & "Discount 25% untuk 30
orang ++" & vbNewLine & vbNewLine & "Rp. 50.000"
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Jakarta")) Then
Label3.Caption = "Batas minimal 40 Orang" & vbNewLine & "Discount 25% untuk 40
orang ++" & vbNewLine & vbNewLine & "Rp. 15.000"
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Yogyakarta")) Then
Label3.Caption = "Batas minimal 50 Orang" & vbNewLine & "Discount 25% untuk 50
orang ++" & vbNewLine & vbNewLine & "Rp. 35.000"
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Bali")) Then
Label3.Caption = "Batas minimal 60 Orang" & vbNewLine & "Discount 25% untuk 60
orang ++" & vbNewLine & vbNewLine & "Rp. 70.000"
End If
End Sub

Private Sub Command1_Click()


If ((biasa.Value = True) And (Combo1.Text = "Jakarta")) Then
If btiket.Text <= 50 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Tidak Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 10000
ElseIf btiket.Text > 50 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 10000) - ((btiket.Text - 50) * 0.25 * 10000)
End If
ElseIf ((biasa.Value = True) And (Combo1.Text = "Yogyakarta")) Then
If btiket.Text <= 40 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Tidak Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 25000
ElseIf btiket.Text > 40 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 25000) - ((btiket.Text - 40) * 0.25 * 25000)
End If
ElseIf ((biasa.Value = True) And (Combo1.Text = "Bali")) Then
If btiket.Text <= 30 Then
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 50000
ElseIf btiket.Text > 30 Then
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 50000) - ((btiket.Text - 30) * 0.25 * 50000)
End If
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Jakarta")) Then
If btiket.Text <= 40 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Tidak Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 15000
ElseIf btiket.Text > 40 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 15000) - ((btiket.Text - 40) * 0.25 * 15000)
End If
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Yogyakarta")) Then
If btiket.Text <= 50 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Tidak Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 35000
ElseIf btiket.Text > 50 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 35000) - ((btiket.Text - 50) * 0.25 * 35000)
End If
ElseIf ((luarbiasa.Value = True) And (Combo1.Text = "Bali")) Then
If btiket.Text <= 60 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Tidak Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = btiket.Text * 70000
ElseIf btiket.Text > 60 Then
Label5.Caption = "Tiket " + btiket.Text + " Orang" & vbNewLine & "Mendapat
Discount"
Label6.Caption = "Rp. "
Label7.Caption = (btiket.Text * 70000) - ((btiket.Text - 60) * 0.25 * 15000)
End If
End If
End Sub

Private Sub Form_Load()


Timer1.Enabled = True
End Sub

Private Sub luarbiasa_Click()


Combo1.Clear
Combo1.Text = "Pilih Tujuan"
Label3.Caption = ""
If luarbiasa.Value = True Then
Combo1.AddItem "Jakarta"
Combo1.AddItem "Yogyakarta"
Combo1.AddItem "Bali"
End If
End Sub

Private Sub Timer1_Timer()


ProgressBar1.Value = ProgressBar1.Value + 1
If ProgressBar1.Value = ProgressBar1.Max Then
Timer1.Enabled = False
biasa.Value = False
luarbiasa.Value = False
Combo1.Text = "Pilih Tujuan"
Label3.Caption = ""
btiket.Text = ""
Label6.Caption = ""
Label5.Caption = ""
Label7.Caption = ""
ProgressBar1.Value = ProgressBar1.Min
Timer1.Enabled = True
End If
End Sub
MODUL IV
1. Bilangan 1 – 100

FORM 1
Property Caption Name
Frame1 Bilangan Ganjil Genap Frame1
Command1 Ganjil Command2
Command2 Genap Command2
List1 List1

Dim x As Integer

Private Sub Command1_Click()


List1.Clear
x=1
Do While (x <= 100)
List1.AddItem x
x=x+2
Loop
End Sub

Private Sub Command2_Click()


List1.Clear
x=2
Do While (x <= 100)
List1.AddItem x
x=x+2
Loop
End Sub

 Looping

FORM 1
Property Caption Name
Label1 Nilai Pertama Label1
Label2 Nilai Kedua Label2
Labe3 Hasil Label3
Tetx1 Text1
Text2 Text2
Text3 Text3
Listbox List1
Command1 Kali Command1
Command2 Tambah Command2

Dim a, b As Integer

Private Sub Command1_Click()


List1.Clear
Text3.Text = ""
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a & " * " & b & " = " & a * b
For c = 0 To b
List1.AddItem a & " * " & c & " = " & a * c
Next
End Sub

Private Sub Command2_Click()


List1.Clear
Text3.Text = ""
a = Val(Text1.Text)
b = Val(Text2.Text)
Text3.Text = a & " + " & b & " = " & a + b
For c = 0 To b
List1.AddItem a & " + " & c & " = " & a + c
Next
End Sub

You might also like