Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 11

1.

Disain Form Sbb :

2. Setting Properties sbb :

Nama Component Properties


Frame1 Caption = spaces
Frame2 Caption = Discount
Text1 Name = Text1(0)
Text = spaces
Text1 Name = Text(1)
Text = spaces
Text1 Name = Text(2)
Text = spaces
Text1 Name = Text1(3)
Text = spaces
Text1 Name = Text(4)
Text = spaces
Text1 Name = Text(5)
Text = spaces
Text1 Name = Text1(6)
Text = spaces
Option1 Name = Optya
Caption = Ya
Option2 Name = Opttidak
Caption = Tidak
Command1 Name = cmdmulai
Caption =&Mulai
Command2 Name = cmdSelesai
Caption =&Selesai

3. Double click Mulai isi source program


Private Sub cmdmulai_Click()
Dim i As Byte
For i = 0 To 5
text1(i).Text = ""
Next i
text1(0).SetFocus
End Sub

4. Double click Mulai isi source program


Private Sub cmdselesai_Click()
End
End Sub

5. Double click Tidak isi source program


Private Sub opttidah_Click()
Dim nilai As Double
nilai = Val(text1(3).Text) * Val(text1(2).Text)
text1(5).Text = Format(nilai, "#,###")
End Sub

6. Double click Ya isi source program


Private Sub optya_Click()
Dim nilai, nilai1 As Double
nilai = Val(text1(3).Text) * Val(text1(2).Text)
nilai1 = 0.1 * nilai
text1(5).Text = Format(nilai1, "#,###")
End Sub
7. Double click Text1 isi source program
Private Sub text1_Change(Index As Integer)
Dim nilai, nilai1 As Double
nilai = Val(text1(3).Text) * Val(text1(2).Text)
text1(4).Text = Format(nilai, "#,###")
If optya.Value Then
nilai1 = 0.1 * nilai
text1(5).Text = Format(nilai1, "#,###")
Else
text1(5).Text = 0
End If
text1(6).Text = Format(nilai - nilai1, "#,###")
End Sub

Hasil pengamatan : (Untuk MenjalankanClick Run | Start)

Langkah-Langkah Untuk Menyusun Praktikum 12, adl:


Click Start | Program | Microsoft Visual Studio | Microsoft Visual Basic 6.0
Pilih Standard, kemudian pilih Open
Click File | Project, beri nama File sbb :

Nama File Project : “Pprak_12.VBP”


Nama File Form : “Fprak_12.Frm”
1. Disain Form Sbb :

2. Setting Properties sbb :

Nama Component Properties


Frame1 Caption = spaces
Text1 Name = txtnobp
Text = spaces
Text2 Name = txtnama
Text = spaces
Text3 Name = txtmutu
Text = spaces
Text4 Name = txtpredikat
Text = spaces
Combo1 Name = cbojeniskelamin
Text = spaces
Combo2 Name = cboasalslta
Text = spaces
Combo3 Name = cbonilaihuruf
Text = spaces
Label1 Name = Label1
Caption = Input Data Mahasiswa
Label2 Name = Label1
Caption = Nobp
Label3 Name = Label1
Caption = Nama
Label4 Name = Label1
Caption = Jenis Kelamin
Label5 Name = Label1
Caption = Asal SLTA
Label6 Name = Label1
Caption = Nilai Huruf
Label7 Name = Label1
Caption = Mutu
Label8 Name = Label1
Caption = Predikat
Command1 Name = cmdStart
Caption =&Start
Command2 Name = cmdUlang
Caption =&Ulang
Command3 Name = cmdClose
Caption =&Close

3. Buat Function dan isi source program


Function bform()
txtnobp.Text = ""
txtnama.Text = ""
txtmutu.Text = ""
txtpredikat.Text = ""
cbojeniskelamin.Text = ""
cboasalslta.Text = ""
cbonilaihuruf.Text = ""
txtnobp.SetFocus
End Function

4. Double Click Combo1(Nilai Huruf) isi source program


Private Sub cbonilaihuruf_Click()
Select Case cbonilaihuruf.List(cbonilaihuruf.ListIndex)
Case "A"
mutu = 4
pdk = "Sangat Memuaskan"
Case "B"
mutu = 3
pdk = "Memuaskan"
Case "C"
mutu = 2
pdk = "Cukup"
Case "D"
mutu = 1
pdk = "Kurang"
Case "E"
mutu = 0
pdk = "Sangat Kurang"
End Select
txtmutu.Text = mutu
txtpredikat.Text = pdk
End Sub

5. Double Click Start isi source program


Private Sub cmdstart_Click(Index As Integer)
Select Case Index
Case 0
Call bform
Case 1
Call bform
Case 2
Unload Me
End Select
End Sub

6. Double Click Pada Form isi source program


Private Sub Form_Load()
Dim i As Byte
cbojeniskelamin.List(0) = "Laki-Laki"
cbojeniskelamin.List(1) = "Perempuan"
cboasalslta.List(0) = "SMU"
cboasalslta.List(1) = "STM"
cboasalslta.List(2) = "MAN"
cboasalslta.List(3) = "SMK"
For i = 0 To 4
cbonilaihuruf.List(i) = Chr(i + 65)
Next
End Sub

7. Double Click TxtNobp isi source program


Private Sub txtnobp_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

8. Double Click CboJenisKelamin isi source program


Private Sub cbojeniskelamin_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

9. Double Click CboAsalSLTA isi source program


Private Sub cboasalslta_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

10.Double Click CboNilaihuruf isi source program


Private Sub cbonilaihuruf_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

11.Double Click Txtmutu isi source program


Private Sub txtmutu_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

12.Double Click TtxPredikat isi source program


Private Sub txtpredikat_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
SendKeys "{tab}"
KeyAscii = 0
End If
End Sub

Hasil pengamatan : (Untuk MenjalankanClick Run | Start)

Langkah-Langkah Untuk Menyusun Praktikum 13, adl:


Click Start | Program | Microsoft Visual Studio | Microsoft Visual Basic 6.0
Pilih Standard, kemudian pilih Open
Click File | Project, beri nama File sbb :

Nama File Project : “Pprak_13.VBP”


Nama File Form : “Fprak_13.Frm”
1. Disain Form Sbb :

2. Setting Properties sbb :

Nama Component Properties


Text1 Name = txtkb
Text = spaces
Text2 Name = txtnb
Text = spaces
Text3 Name = txtdb
Text = spaces
Text4 Name = txtjml
Text = spaces
Text5 Name = txthb
Text = spaces
Text6 Name = txtnp
Text = spaces
Text7 Name = txtdc
Text = spaces
Text8 Name = txttp
Text = spaces
Text9 Name = txtpc
Text = spaces
Label1 Name = Label1
Caption = Kode Barang
Label2 Name = Label2
Caption = Nama Barang
Label3 Name = Label3
Caption = Satuan
Label4 Name = Label4
Caption = Jumlah
Label5 Name = Label5
Caption = Harga
Label6 Name = Label6
Caption = Nilai Penjualan
Label7 Name = Label7
Caption = Total Penjualan
Label8 Name = Label8
Caption = Discount
Label9 Name = Label9
Caption = Percent
Label10 Name = Label10
Caption = %

3. Double Click General isi source program


Dim np, tp, pc, dc As Double

4. Double Click TxtHB isi source program


Private Sub txthb_Change()
np = Val(txtjml.Text) * Val(txthb.Text)
If (np >= 100000) And (np < 500000) Then
pc = 0.1
ElseIf (np >= 500000) And (np < 1000000) Then
pc = 0.15
ElseIf (np >= 1000000) And (np < 1500000) Then
pc = 0.17
ElseIf (np >= 1500000) Then
pc = 0.2
End If
dc = pc * np
tp = np - dc
txtnp.Text = Format(np, "#,###")
txttp.Text = Format(tp, "#,###")
txtpc.Text = pc
txtdc.Text = Format(dc, "#,###")
End Sub

5. Double Click TxtJml isi source program


Private Sub txtjml_Change()
np = Val(txtjml.Text) * Val(txthb.Text)
If (np >= 100000) And (np < 500000) Then
pc = 0.1
ElseIf (np >= 500000) And (np < 1000000) Then
pc = 0.15
ElseIf (np >= 1000000) And (np < 1500000) Then
pc = 0.17
ElseIf (np >= 1500000) Then
pc = 0.2
End If
dc = pc * np
tp = np - dc
txtnp.Text = Format(np, "#,###")
txttp.Text = Format(tp, "#,###")
txtpc.Text = pc
txtdc.Text = Format(dc, "#,###")
End Sub

Hasil pengamatan : (Untuk MenjalankanClick Run | Start)

You might also like