Aside 28 Feb

Tugas VB Pertemuan Ke 3

Membuat 10 Program

Nama : Ridwan

Kelas : Twitter 12

MK : Visual Basic

1.Kalkulator Sederhana

Kalkulotar Sederhana

Source Code :

Private Sub Command1_Click()
C = Val(A.Text) + Val(B.Text)
End Sub

Private Sub Command2_Click()
C = Val(A.Text) – Val(B.Text)
End Sub

Private Sub Command3_Click()
C = Val(A.Text) * Val(B.Text)
End Sub

Private Sub Command4_Click()
C = Val(A.Text) / Val(B.Text)
End Sub

Private Sub Command5_Click()
C = Val(A.Text) ^ Val(B.Text)
End Sub

Private Sub Command6_Click()
A.Text = Clear
B.Text = Clear
C.Text = Clear
A.SetFocus
End Sub

Private Sub Command7_Click()
End
End Sub

2.Properti Test

Properti test

Source Kode :

Private Sub Command1_Click()
Label2.Caption = Text1.Text
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Option1_Click()
Label2.ForeColor = vbBlue
End Sub

Private Sub Option2_Click()
Label2.ForeColor = vbRed
End Sub

Private Sub Check1_Click()
Label2.FontBold = Check1.Value
End Sub

Private Sub Check2_Click()
Label2.FontItalic = Check2.Value
End Sub

3.Font Color

MD font Color

Source Kode :

Private Sub chkBold_Click()
‘membuat teks tebal
If chkBold.Value = 1 Then
lblTeks.FontBold = True
Else
lblTeks.FontBold = False
End If
End Sub

Private Sub chkItalic_Click()
‘membuat teks miring
If chkItalic.Value = 1 Then
lblTeks.FontItalic = True
Else
lblTeks.FontItalic = False
End If
End Sub

Private Sub chkStrike_Click()
‘membuat teks bergaris tengah
If chkStrike.Value = 1 Then
lblTeks.FontStrikethru = True
Else
lblTeks.FontStrikethru = False
End If
End Sub

Private Sub chkUnder_Click()
‘membuat teks bergaris bawah
If chkUnder.Value = 1 Then
lblTeks.FontUnderline = True
Else
lblTeks.FontUnderline = False
End If
End Sub

Private Sub cmdExit_Click()
End
End Sub

4.Data Nama Pasien

Data Nama Pasien

Source kode

Private Sub Form_Load()
Text3 = Format(Now, “DD-MMMM-YYYY”)
Text4 = Format(Now, “HH:MM”)
Text3.Enabled = False
Text4.Enabled = False

Combo1.AddItem “PRIA”
Combo1.AddItem “WANITA”
End Sub

Private Sub Text1_keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text5_keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text6.SetFocus
End If
End Sub
End Sub

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Command2_Click()
Text1.Text = “”
Text2.Text = “”
Text5.Text = “”
Text6.Text = “”
Combo1.Text = “”
End Sub

5.Aplikasi Perhitungan Gaji

Aplikasi Perhitungan gaji

Surce kode :

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)
Text5.Text = Val(Text4.Text) * 0.2
Text6.Text = Val(Text4.Text) – Val(Text5.Text)
End If
End Sub

Private Sub Command1_Click()
Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)
Text5.Text = Val(Text4.Text) * 0.2
Text6.Text = Val(Text4.Text) – Val(Text5.Text)
End Sub

Private Sub Command2_Click()
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
Text1.SetFocus
End Sub

Private Sub Command3_Click()
End
End Sub

6.Perhitungan Diskon

5.MD perhitungan diskon

Source Kode :

Private Sub Combo1_Click()
Combo1.AddItem “ABA”
Combo1.AddItem “AMIK”
Combo1.AddItem “AKA”
End Sub

Private Sub Combo2_Click()
If Combo2 = “MI-0101-KTI” Then
Text4.Text = “Konsep Teknologi Informasi”
Text5.Text = “4″
Text6.Text = “20000″
Text6.SetFocus
Else
End If

If Combo2 = “MI-0102-PA” Then
Text4.Text = “Penghantar Akutansi”
Text5.Text = “4″
Text6.Text = “25000″
Text6.SetFocus
Else
End If

If Combo2 = “MI-0103-LA” Then
Text4.Text = “Logika ALgoritma”
Text5.Text = “3″
Text6.Text = “30000″
Text6.SetFocus
Else
End If

If Combo2 = “MI-0104-MD” Then
Text4.Text = “Matematika Dasar”
Text5.Text = “2″
Text6.Text = “15000″
Text6.SetFocus
Else
End If

If Combo2 = “BA-0101-LS” Then
Text4.Text = “Listening”
Text5.Text = “4″
Text6.Text = “25000″
Text6.SetFocus
Else
End If

If Combo2 = “BA-0101-SP” Then
Text4.Text = “speaking”
Text5.Text = “3″
Text6.Text = “40000″
Text6.SetFocus
Else
End If

If Combo2 = “BA-0101-CV” Then
Text4.Text = “Conversation”
Text5.Text = “2″
Text6.Text = “35000″
Text6.SetFocus
Else
End If
End Sub

Private Sub Command1_Click()
Text9.Text = Val(Text7.Text) – Val(Text8.Text)
End Sub

Private Sub Form_Load()
Combo1.AddItem “ABA”
Combo1.AddItem “AMIK”
Combo1.AddItem “AKA”
Combo2.AddItem “MI-0101-KTI”
Combo2.AddItem “MI-0102-PA”
Combo2.AddItem “MI-0103-LA”
Combo2.AddItem “MI-0104-MD”
Combo2.AddItem “BA-0101-LS”
Combo2.AddItem “BA-0101-SP”
Combo2.AddItem “BA-0101-CV”
End Sub

Private Sub Option1_Click()
Text8.Text = Val(Text7.Text) * 0.5
End Sub

Private Sub Option2_Click()
Text8.Text = Val(Text7.Text) * 0.1
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

7.Gaji Karyawan

MD Gaji Karyawan

Source Kode :

Private Sub Command1_Click()
Text9.Text = Val(Text6.Text) – Val(Text8.Text)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text6.Text = Val(Text3.Text) + Val(Text4.Text) + Val(Text4.Text)
Text7.SetFocus
End If
End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text8.Text = Val(Text6.Text) * Val(Text7.Text) / 100
Text8.SetFocus
End If
End Sub

8.Nilai Mutu

Nilai Mutu

Source Kode :

Private Sub Form_Load()
Combo1.AddItem “12100515″
Combo1.AddItem “12100525″
Combo1.AddItem “12100535″
Combo1.AddItem “12100545″
Combo1.AddItem “12100555″
Combo1.AddItem “12100565″
Combo1.AddItem “12100575″
Combo1.AddItem “12100585″
Combo1.AddItem “12100595″
Combo1.AddItem “12100666″
End Sub

Private Sub Combo1_Click()
If Combo1 = “12100515″ Then
txtNama.Text = “Marchoni”
txtjurusan.Text = “Sistem Informasi”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100525″ Then
txtNama.Text = “Siti Kholijah”
txtjurusan.Text = “Sistem Informasi”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100535″ Then
txtNama.Text = “Adi Setiawan”
txtjurusan.Text = “Sistem Informasi”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100545″ Then
txtNama.Text = “Barnes Setiawan”
txtjurusan.Text = “Manajemen Informatika”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100555″ Then
txtNama.Text = “Adhy Pangestu”
txtjurusan.Text = “Manajemen Informatika”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100565″ Then
txtNama.Text = “Setiawan Adi”
txtjurusan.Text = “Design Grafis”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100575″ Then
txtNama.Text = “Sunardi”
txtjurusan.Text = “Manajemen Informatika”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100585″ Then
txtNama.Text = “Arif Lukman”
txtjurusan.Text = “Manajemen Informatika”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100595″ Then
txtNama.Text = “Alivia”
txtjurusan.Text = “Sistem Informasi”
txtQuis.SetFocus
Else
End If

If Combo1 = “12100666″ Then
txtNama.Text = “Adi Barnes Setiawan”
txtjurusan.Text = “Design Grafis”
txtQuis.SetFocus
Else
End If
End Sub

Private Sub txtQuis_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtTugas.SetFocus
End If
End Sub

Private Sub txtTugas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtUts.SetFocus
End If
End Sub

Private Sub txtUas_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtNA.Text = (Val(txtQuis.Text) + Val(txtTugas.Text) + Val(txtUts.Text) + Val(txtUas.Text)) / 4
If Val(txtNA.Text) <= 50 Then txtHuruf.Text = “E”
If Val(txtNA.Text) >= 50 Then txtHuruf.Text = “D”
If Val(txtNA.Text) >= 60 Then txtHuruf.Text = “C”
If Val(txtNA.Text) >= 70 Then txtHuruf.Text = “B”
If Val(txtNA.Text) >= 80 Then txtHuruf.Text = “A”
End If
End Sub

Private Sub txtUts_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txtUas.SetFocus
End If
End Sub

Private Sub cmdProses_Click()
txtNA.Text = (Val(txtQuis.Text) + Val(txtTugas.Text) + Val(txtUts.Text) + Val(txtUas.Text)) / 4
If Val(txtNA.Text) <= 50 Then txtHuruf.Text = “E”
If Val(txtNA.Text) >= 50 Then txtHuruf.Text = “D”
If Val(txtNA.Text) >= 60 Then txtHuruf.Text = “C”
If Val(txtNA.Text) >= 70 Then txtHuruf.Text = “B”
If Val(txtNA.Text) >= 80 Then txtHuruf.Text = “A”
End Sub

Private Sub cmdBatal_Click()
txtNama.Text = “”
txtjurusan.Text = “”
txtQuis.Text = “”
txtTugas.Text = “”
txtUts.Text = “”
txtUas.Text = “”
txtNA.Text = “”
txtHuruf.Text = “”
txtNama.SetFocus
End Sub

Private Sub cmdKeluar_Click()
End
End Sub

9.Penjualan

Penjualan

Source kode :

Private Sub Text1_Keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text2.SetFocus
End If
End Sub

Private Sub Text2_Keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text3.SetFocus
End If
End Sub

Private Sub Text3_Keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text4.SetFocus
End If
End Sub

Private Sub Text4_Keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text7.Text = Val(Text3.Text) * Val(Text4.Text)
Text8.SetFocus
End If
End Sub

Private Sub Text8_Keypress(keyAscii As Integer)
If keyAscii = 13 Then
Text9.Text = Val(Text8.Text) – Val(Text7.Text)
End If
End Sub

Private Sub Command1_Click()
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text7.Text = “”
Text8.Text = “”
Text9.Text = “”
Text1.SetFocus
End Sub

Private Sub Command2_Click()
End
End Sub

10.Data Mahasiswa

Data Mahasiswa

Source Kode :

Private Sub Command1_Click()
Dim S As String
Text5.Text = “20″ & Left(Text2.Text, 2)
S = Mid(Text2.Text, 3, 1)
If S = “1″ Then
Text3.Text = “Sistem Informasi”
ElseIf S = “2″ Then
Text3.Text = “Manajemen Informatika”
ElseIf S = “3″ Then
Text3.Text = “Tehnik Informatika”
ElseIf S = “4″ Then
Text3.Text = “Manajemen & Komp. Akuntansi”
End If
S = Mid(Text2.Text, 4, 2)
If S = “01″ Then
Text4.Text = “Strata Satu”
ElseIf S = “02″ Then
Text4.Text = “Diploma Tiga”
ElseIf S = “03″ Then
Text4.Text = “Diploma Empat”
ElseIf S = “04″ Then
Text4.Text = “Diploma Dua”
End If
Text6.Text = Right(Text2.Text, 3)
End Sub

Private Sub Command2_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Command3_Click()
Text1.SetFocus
Text1.Text = “”
Text2.Text = “”
Text3.Text = “”
Text4.Text = “”
Text5.Text = “”
Text6.Text = “”
End Sub

Private Sub Command4_Click()
End
End Sub

Private Sub Text1_KEYPRESS(KEYASCII As Integer)
If KEYASCII = 13 Then
Text2.SetFocus
End If
End Sub

TUGAS VISUAL BASIC 2

14 Feb

kalkulator-mini

nama   ;ridwan

npm    :12201159

kelas   :twitter 12

 

private sub text1_keypress(keyascii as integer)

if keyascii = 13 then

text2.setfocus

end if

end sub

private sub text2_keypress(keyascii as integer)

if keyascii = 13 then

text3.text = val (text1.text)+val(text2.text)

text4.text = val(text1.text)*val(text2.text)

text5.text=val(text1.text)/val(text2.text)

text6.text=val(text1.text)-val(text2.text)

end if

end sub

private sub command1_click ()

text3.text = val(text1.text)+val(text2.text)

text4.text = val(text1.text)*val(text2.text)

text5.text = val(text1.text)/val(text2.text)

text6.text =val(text1.text)-val(text2.text)

end sub

 

private sub command2_click ()

text1.text = ” ”

text2.text = ” ”

twxt3.text = ” ”

text4.text = ” ”

text5.text = ” ”

text6.text = ” ”

text1.setfocus

end sub

private sub command3_click ()

end end sub