Rabu, 11 April 2012

LA Visual Basic II

Form 1
Private Sub Command1_Click()
Dim nama, pass As String

nama = InputBox("Masukan nama anda : ", "input Nama")
pass = InputBox("Masukan password anda : ", "input Password")
If pass = "labsi" Then
msg = MsgBox("Username anda adlah : " + nama & vbCrLf & "Paswor benar, Silahkan masuk",
vbOKOnly, "anda Berhasil")
Form2.Show
Unload Me
Else
msg = MsgBox("Password salah", vbCritical, "Anda Gagal")
Unload Me
End If
End Sub

Private Sub Command2_Click()
End
End Sub

Form 2
Pilih Tool > Menu Editor. Lalu Buat seperti gambar dibawah :
 Maka akan menjadi seperti ini :
Private Sub conversikata_Click()
Form3.Show
Unload Me
End Sub

Private Sub program_kondisi_Click()
Form4.Show
Unload Me
End Sub

Private Sub program_looping_Click()
Form5.Show
Unload Me
End Sub

Form 3
Private Sub Command1_Click()
ket.Caption = npmtext.Text + " " + namatext.Text + " " + kelastext.Text
MsgBox "Nama Anda " & namatext.Text & " NPM Anda " & npmtext.Text & " Kelas Anda " & kelastext.Text, vbInformation, "Perhatian"
End Sub

Private Sub Command2_Click()
npmtext.Text = Clear
namatext.Text = Clear
kelastext.Text = Clear
ket.Caption = Clear
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Command4_Click()
If npmtext.FontBold = False Then
npmtext.FontBold = True
kelastext.FontBold = True
namatext.FontBold = True
ket.FontBold = True
Else
npmtext.FontBold = False
kelastext.FontBold = False
namatext.FontBold = False
ket.FontBold = False
End If
End Sub

Private Sub Command5_Click()
If npmtext.FontItalic = False Then
npmtext.FontItalic = True
kelastext.FontItalic = True
namatext.FontItalic = True
ket.FontItalic = True
Else
npmtext.FontItalic = False
kelastext.FontItalic = False
namatext.FontItalic = False
ket.FontItalic = False
End If
End Sub

Private Sub Command6_Click()
If npmtext.FontUnderline = False Then
npmtext.FontUnderline = True
kelastext.FontUnderline = True
namatext.FontUnderline = True
ket.FontUnderline = True
Else
npmtext.FontUnderline = False
kelastext.FontUnderline = False
namatext.FontUnderline = False
ket.FontUnderline = False
End If
End Sub

Private Sub Command7_Click()
If npmtext.ForeColor = vbBlack Then
npmtext.ForeColor = vbRed
kelastext.ForeColor = vbRed
namatext.ForeColor = vbRed
ket.ForeColor = vbRed
Else
npmtext.ForeColor = vbBlack
kelastext.ForeColor = vbBlack
namatext.ForeColor = vbBlack
ket.ForeColor = vbBlack
End If
End Sub

Private Sub Command8_Click()
If npmtext.ForeColor = vbBlack Then
npmtext.ForeColor = vbBlue
kelastext.ForeColor = vbBlue
namatext.ForeColor = vbBlue
ket.ForeColor = vbBlue
Else
npmtext.ForeColor = vbBlack
kelastext.ForeColor = vbBlack
namatext.ForeColor = vbBlack
ket.ForeColor = vbBlack
End If
End Sub

Form 4
Private Sub Command1_Click()
Dim nama As String
Dim nilai1 As Integer
Dim nilai2 As String

nama = InputBox("Masukan Nama Anda :", "Input Nama")
nilai1 = InputBox("Masukan Nilai Anda :", "Input Nilai")

If nilai1 < 65 Then
nilai2 = Val(nilai1)
Label1.Caption = nilai2
MsgBox "Maaf  " + nama & vbCrLf & "Dengan Nilai  " + nilai2 + "  Anda tidak lulus"
Else
niali2 = Val(nilai1)
Label1.Caption = nilai2
MsgBox "selamat" + nama + "anda Lulus"
End If
End Sub

Private Sub Command2_Click()
Form2.Show
Unload Me
End Sub

Form 5
Private Sub Command1_Click()
a = Val(Text1.Text)

For b = 1 To a
    For c = 1 To b
        Print c;
    Next c
    Print
Next b
For b = a - 1 To 1 Step -1
    For c = 1 To b
        Print c;
    Next c
    Print
Next b
End Sub

0 komentar:

Posting Komentar

 
;