Materi kuliah Pemrograman Aplikasi Terpadu - Pertemuan 2
Tentang :
- For
- Generate password
Coding contoh for pada kasus perhitungan suara :
Private Sub Command12_Click()
hk1 = ""
For i = 1 To Text0.Value
hk1 = hk1 & "*"
Next
p1 = Round((CInt(Text0.Value) / (CInt(Text0.Value) + CInt(Text2.Value) + CInt(Text4.Value))) * 100)
Label7.Caption = hk1 & " " & p1 & "%"
hk2 = ""
For i = 1 To Text2.Value
hk2 = hk2 & "*"
Next
p2 = Round((CInt(Text2.Value) / (CInt(Text0.Value) + CInt(Text2.Value) + CInt(Text4.Value))) * 100)
Label10.Caption = hk2 & " " & p2 & "%"
hk3 = ""
For i = 1 To Text4.Value
hk3 = hk3 & "*"
Next
p3 = Round((CInt(Text4.Value) / (CInt(Text0.Value) + CInt(Text2.Value) + CInt(Text4.Value))) * 100)
Label11.Caption = hk3 & " " & p3 & "%"
End Sub
Private Sub Command13_Click()
Text0.Value = ""
Text2.Value = ""
Text4.Value = ""
Label7.Caption = ""
Label10.Caption = ""
Label11.Caption = ""
End Sub
Coding contoh for pada kasus generate password :
Private Sub Command4_Click()
a = ""
For x = Len(Text0.Value) To 1 Step -1
a = a + Mid(Text0.Value, x, 1)
Next
Text2.Value = a
End Sub
0 komentar:
Post a Comment