Visual Basic tugas 3

LAPORAN

TUGAS 3 PEMROGRAMAN VISUAL BASIC 1

 

 

Disusun untuk memenuhi tugas mata kuliah Pemrograman Visual Basic 1

Pada Program Pendidikan Strata Satu Jurusan Sistem Informasi

Sekolah Tinggi Manajemen Informatika dan Komputer

STMIK Pringsewu

 

 

DISUSUN OLEH:

NAMA : ARIYANI

NPM : 10100205

 

Sekolah Tinggi Manajemen Informatika dan Komputer

STMIK Pringsewu Lampung

2011

 

 

 

 

HOMEWORK III

PRAKTIKUM 1


Private Sub Command1_Click()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

End Sub

Private Sub Command2_Click()

Unload Me

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

PRAKTIKUM 2

Private Sub Check1_Click()

If (Check1.Value = 1) And (Check2.Value = 1) Then

Label2.FontBold = True

Label2.FontItalic = True

ElseIf (Check1.Value = 1) And (Check2.Value = 0) Then

Label2.FontBold = True

Label2.FontItalic = False

ElseIf (Check1.Value = 0) And (Check2.Value = 1) Then

Label2.FontBold = False

Label2.FontItalic = True

ElseIf (Check1.Value = 0) And (Check2.Value = 0) Then

Label2.FontBold = False

Label2.FontItalic = False

End If

End Sub

Private Sub Check2_Click()

If (Check1.Value = 1) And (Check2.Value = 1) Then

Label2.FontBold = True

Label2.FontItalic = True

ElseIf (Check1.Value = 1) And (Check2.Value = 0) Then

Label2.FontBold = True

Label2.FontItalic = False

ElseIf (Check1.Value = 0) And (Check2.Value = 1) Then

Label2.FontBold = False

Label2.FontItalic = True

ElseIf (Check1.Value = 0) And (Check2.Value = 0) Then

Label2.FontBold = False

Label2.FontItalic = False

End If

End Sub

Private Sub Command1_Click()

Label2.Caption = (Text1.Text)

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Option1_Click()

If Option1.Value = True Then

Label2.ForeColor = vbBlue

End If

End Sub

Private Sub Option2_Click()

If Option2.Value = True Then

Label2.ForeColor = vbRed

End If

End Sub

PRAKTIKUM 3

 

Private Sub Command1_Click()

If (Check1.Value = 1) And (Check2.Value = 1) And (Check3.Value = 1) Then

Text1.FontBold = True

Text1.FontItalic = True

Text1.FontUnderline = True

ElseIf (Check1.Value = 1) And (Check2.Value = 1) And (Check3.Value = 0) Then

Text1.FontBold = True

Text1.FontItalic = True

Text1.FontUnderline = False

ElseIf (Check1.Value = 1) And (Check2.Value = 0) And (Check3.Value = 1) Then

Text1.FontBold = True

Text1.FontItalic = False

Text1.FontUnderline = True

ElseIf (Check1.Value = 1) And (Check2.Value = 0) And (Check3.Value = 0) Then

Text1.FontBold = True

Text1.FontItalic = False

Text1.FontUnderline = False

ElseIf (Check1.Value = 0) And (Check2.Value = 1) And (Check3.Value = 1) Then

Text1.FontBold = False

Text1.FontItalic = True

Text1.FontUnderline = True

ElseIf (Check1.Value = 0) And (Check2.Value = 1) And (Check3.Value = 0) Then

Text1.FontBold = False

Text1.FontItalic = True

Text1.FontUnderline = False

ElseIf (Check1.Value = 0) And (Check2.Value = 0) And (Check3.Value = 1) Then

Text1.FontBold = False

Text1.FontItalic = False

Text1.FontUnderline = True

ElseIf (Check1.Value = 0) And (Check2.Value = 0) And (Check3.Value = 0) Then

Text1.FontBold = False

Text1.FontItalic = False

Text1.FontUnderline = False

End If

End Sub

PRAKTIKUM 4

 

Private Sub Command1_Click()

Dim A, B, C As String

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

End Sub

Private Sub Command2_Click()

Text3.Text = Val(Text1.Text) – (Text2.Text)

End Sub

Private Sub Command3_Click()

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

End Sub

Private Sub Command4_Click()

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

End Sub

Private Sub Command5_Click()

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

End Sub

Private Sub Command6_Click()

Unload Me

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

PRAKTIKUM 5

Private Sub Command1_Click()

Dim Hg, Jp As Integer

Dim Tb As Long

Hg = Val(Text3.Text)

Jp = Val(Text4.Text)

Tb = (Hg * Jp)

Text5.Text = Tb

Text5.SetFocus

End Sub

Private Sub Command2_Click()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

End Sub

Private Sub Command3_Click()

Unload Me

End Sub

Private Sub Form_Activate()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.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

PRAKTIKUM 6

Private Sub Command1_Click()

Dim A, B, C As Double

Text2.Text = Val(Text1.Text) * 0.1

Text3.Text = Val(Text1.Text) – Val(Text2.Text)

End Sub

Private Sub Command2_Click()

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

End Sub

Private Sub Command3_Click()

Unload Me

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

PRAKTIKUM 7

Private Sub Command1_Click()

Dim A, B, C, D, E, F As Double

Text4.Text = Val(Text1.Text) + Val(Text2.Text) – Val(Text3.Text)

Text5.Text = Val(Text4.Text) * (0.1)

Text6.Text = Val(Text4.Text) – Val(Text5.Text)

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()

Unload Me

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

Private Sub Text2_Change()

If KeyAscii = 13 Then

Text3.SetFocus

End If

End Sub

Private Sub Text3_Change()

If KeyAscii = 13 Then

Text4.SetFocus

End If

End Sub

Private Sub Text4_Change()

If KeyAscii = 13 Then

Text5.SetFocus

End If

End Sub

Private Sub Text5_Change()

If KeyAscii = 13 Then

Text6.SetFocus

End If

End Sub

PRAKTIKUM 8

Private Sub cbonpm_Click()

Dim nama, jurusan As String

Select Case cbonpm.Text

Case Is = “10100205”

nama = “ARIYANI”

jurusan = “SISTEM INFORMASI”

Case Is = “10201111”

nama = “RIA TRISNALIA”

jurusan = “MANAJEMEN INFORMATIKA”

Case Is = “09302221”

nama = “CHANDRA LESMANA”

jurusan = “TEKHNIK INFORMATIKA”

End Select

txtnama.Text = nama

txtjurusan.Text = jurusan

End Sub

Private Sub Command1_Click()

Dim Quis, Tugas, UTS, UAS, N_Akhir As Integer

Dim HM As String

Quis = Val(txtquis.Text)

Tugas = Val(txttugas.Text)

UTS = Val(txtuts.Text)

UAS = Val(txtuas.Text)

N_Akhir = (Quis + Tugas + UTS + UAS) / 4

txtnilaiakhir.Text = N_Akhir

txtnilaiakhir.SetFocus

Select Case txtnilaiakhir.Text

Case Is > 80

HM = “A”

Case Is > 70

HM = “B”

Case Is > 60

HM = “C”

Case Is > 50

HM = “D”

Case Is < 50

HM = “E”

End Select

txtHM.Text = HM

End Sub

Private Sub Command2_Click()

txtquis.SetFocus

txtquis.Text = “”

txttugas.Text = “”

txtuts.Text = “”

txtuas.Text = “”

End Sub

Private Sub Command3_Click()

Unload Me

End Sub

Private Sub Form_Load()

cbonpm.AddItem “10100205”

cbonpm.AddItem “10201111”

cbonpm.AddItem “09302221”

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 txtuts_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

txtuas.SetFocus

End If

End Sub

PRAKTIKUM 9

Private Sub Combo1_Click()

Dim gapok, pajak, tunjangan, total As Variant

Select Case Combo1.Text

Case “I”

gapok = 1500000

tunjangan = 150000

Case “II”

gapok = 2000000

tunjangan = 200000

Case “III”

gapok = 2500000

tunjangan = 250000

Case “IV”

gapok = 3000000

tunjangan = 300000

Case Else

gapok = 0

tunjangan = 0

End Select

total = gapok + tunjangan

pajak = total * 0.1

Text3.Text = gapok

Text4.Text = tunjangan

Text5.Text = pajak

Text6.Text = total – pajak

Text6.Text = total

End Sub

Public Sub kosong()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text6.Text = “”

Combo1.Text = “”

End Sub

Private Sub Command1_Click()

kosong

End Sub

Private Sub Command2_Click()

kosong

End Sub

Private Sub Command3_Click()

Unload Me

End Sub

Private Sub Form_Load()

Combo1.AddItem “I”

Combo1.AddItem “II”

Combo1.AddItem “III”

Combo1.AddItem “IV”

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

PRAKTIKUM 10

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”

End If

S = Mid(Text2.Text, 4, 2)

If S = “00” Then

Text4.Text = “STRATA SATU”

ElseIf S = “01” Then

Text4.Text = “DIPLOMA TIGA”

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()

Unload Me

End Sub

Private Sub Form_Activate()

Text1.SetFocus

Text1.Text = “”

Text2.Text = “”

Text3.Text = “”

Text4.Text = “”

Text5.Text = “”

Text6.Text = “”

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 Then

Text2.SetFocus

End If

End Sub

2 Tanggapan

  1. gak da lagi app praktek vb yang lain nya

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: