19 Apr 2011

contoh vb (visual basic)

Add caption
contoh program Vb sederhana. 
penilaian kelulusan mahasiswa...
   listingnya :
                 
Private Sub Command1_Click()
Dim gender
Dim status

If Option1.Value = True Then
    gender = "LAKI-LAKI"
Else
    gender = "PEREMPUAN"
End If

If Check1.Value = 1 Then
    status = "KULIAH ANDA AKTIF"
End If
If Check2.Value = 1 Then
    status = "CEK PEMBAYARAN"
End If
If Check1.Value = 1 And Check2.Value = 1 Then
    status = "lunas & belum lunas"
End If
If Check1.Value = 0 And Check2.Value = 0 Then
    status = "None"
End If

List1.AddItem "nama =" & txtnama.Text & "" & txtbelakang.Text & "    umur=" & txtumur.Text & "    jenis kelamin= " & gender & " -- " & status & "    mutu= " & Text6.Text & "  ket:" & Text8.Text
End Sub
Private Sub Command2_Click()
Dim number
If List1.List(0) = "" Then Exit Sub
'removing the last item from the list
number = List1.ListCount
List1.RemoveItem (number - 1)

End Sub

Private Sub cmdclear_Click()
cmdproses.Enabled = True
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""

End Sub

Private Sub cmdexit_Click()
If MsgBox("Anda ingin keluar?", vbYesNo + vbQuestion, "BSI MANIA") = vbYes Then
Unload Me
End
Else
End If
End Sub
Private Sub cmdproses_Click()
Dim angka_mutu As Integer

cmdclear.Enabled = True
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Then
MsgBox ("Maaf Nilai Tidak kumplit")
  ElseIf Text1.Text > 100 Or Text1.Text = "" Then
MsgBox ("maaf Masukan angka 0-100 pada Nilai UTS")
  Else
angka_mutu = Text1.Text * 0.3 + Text2.Text * 0.4 + Text3.Text * 0.2 + Text4.Text * 0.1
Text5.Text = angka_mutu
  If Text2.Text > 100 Then
MsgBox ("maaf Masukan angka 0-100 pada Nilai UAS")
  ElseIf Text3.Text > 100 Then
MsgBox ("maaf Masukan angka 0-100 pada Nilai Tugas")
  ElseIf Text4.Text > 100 Then
MsgBox ("maaf Masukan angka 0-100 pada Nilai Absensi")
ElseIf angka_mutu > 76 And angka_mutu <= 100 Then
Text6.Text = "A"
cmdproses.Enabled = False
ElseIf angka_mutu > 66 And angka_mutu <= 75 Then
Text6.Text = "B"
cmdproses.Enabled = False
ElseIf angka_mutu > 55 And angka_mutu <= 65 Then
Text6.Text = "C"
cmdproses.Enabled = False
ElseIf angka_mutu > 40 And angka_mutu <= 54 Then
Text6.Text = "D"
cmdproses.Enabled = False
ElseIf angka_mutu >= 0 And angka_mutu <= 39 Then
Text6.Text = "E"
cmdproses.Enabled = False
End If
If Text6.Text = "A" Then
Text7.Text = "Cumlaude"
   ElseIf Text6.Text = "B" Then
Text7.Text = "Sangat Memuaskan"
   ElseIf Text6.Text = "C" Then
Text7.Text = "Cukup Memuaskan"
   ElseIf Text6.Text = "D" Then
Text7.Text = "Kurang Memuaskan"
   ElseIf Text6.Text = "E" Then
Text7.Text = "Buruk"

End If

If Text6.Text = "A" Then
Text8.Text = "Lulus"
  ElseIf Text6.Text = "B" Then
Text8.Text = "Lulus"
  ElseIf Text6.Text = "C" Then
Text8.Text = "Lulus"
  Else
Text8.Text = "Tidak Lulus"
End If

End If
End Sub

 

Tidak ada komentar:

Posting Komentar

Entri Populer

blog ane ^^

guitar

keluarga

Foto saya
jakarta, Indonesia
memang benar apa yang kita dapat dari pada mengharap ketidak pastian orang lain

Pages

Recent Posts

pertemanan

blog2

__