
Kamis, 20 September 2012
di
00.09
|
Terdapat sembilan label .
Object Textbox
Object Textbox
Terdapat sebelas textbox yang terdiri dari 6 textbox yang berstatus input dan 5 textbox berstatus read only.
Object Button
Terdapat satu object button yang bernama "Bersih" yang digunakan untuk menghapus semua isi textbox.
Script Unique
Saat membuat call prosedur
Public Class Latihan_10_36110037
Private Sub rhepoet(ByVal a As TextBox, ByVal B As TextBox)
If Val(a.Text) <= 50000000 Then
B.Text = (Val(a.Text) * 5 / 100)
Else : B.Text = (Val(a.Text) * 30 / 100)
End If
Saat Textchanged
Private Sub pkp1_36110037_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pkp1_36110037.TextChanged
rhepoet(pkp1_36110037, pph1_36110037)
Saat button click
Private Sub Bersih_36110037_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Bersih_36110037.Click
NP_36110037.Text = ""
pkp1_36110037.Text = ""
Saat membuat call prosedur
Public Class Latihan_10_36110037
Private Sub rhepoet(ByVal a As TextBox, ByVal B As TextBox)
If Val(a.Text) <= 50000000 Then
B.Text = (Val(a.Text) * 5 / 100)
Else : B.Text = (Val(a.Text) * 30 / 100)
End If
Saat Textchanged
Private Sub pkp1_36110037_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pkp1_36110037.TextChanged
rhepoet(pkp1_36110037, pph1_36110037)
Saat button click
Private Sub Bersih_36110037_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Bersih_36110037.Click
NP_36110037.Text = ""
pkp1_36110037.Text = ""
Dst.
Event
Textchanged Buttonclick
Property
Property textbox:
Readonly = True
Prosedur Penyelesaian
1. buka project yang telah dibuat.
2. buka Solution explorer.
3. setelah itu klik kanan nama project, pilih add dan klik new item.
4. setelah add new item terbuka, pilih windows form, windoes form, kemudian ketik nama form, dan add.
5. buat form seperti di bawah ini dengan menggunakan toolbox.
6. setelah form selesai, ubah nama textbox dan button menggunakan properties window.
7. setelah itu, masuk ke lembar "vb" dengan cara mengklik 2x form dan kemudian ketikkan formula berikut.
Public Class Latihan_10_36110037
Private Sub rhepoet(ByVal a As TextBox, ByVal B As TextBox)
If Val(a.Text) <= 50000000 Then
B.Text = (Val(a.Text) * 5 / 100)
ElseIf Val(a.Text) <= 250000000 Then
B.Text = (50000000 * 5 / 100) + ((Val(a.Text) - 50000000) * 15 / 100)
ElseIf Val(a.Text) <= 500000000 Then
B.Text = ((50000000 * 5 / 100) + (200000000 * (15 / 100)) + ((Val(a.Text) - 250000000) * 25 / 100))
Else : B.Text = (Val(a.Text) * 30 / 100)
End If
End Sub
Private Sub pkp1_36110037_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles pkp1_36110037.TextChanged, pkp2_36110037.TextChanged, pkp3_36110037.TextChanged, pkp4_36110037.TextChanged, pkp5_36110037.TextChanged
rhepoet(pkp1_36110037, pph1_36110037)
rhepoet(pkp2_36110037, pph2_36110037)
rhepoet(pkp3_36110037, pph3_36110037)
rhepoet(pkp4_36110037, pph4_36110037)
rhepoet(pkp5_36110037, pph5_36110037)
End Sub
Private Sub Bersih_36110037_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Bersih_36110037.Click
NP_36110037.Text = ""
pkp1_36110037.Text = ""
pkp2_36110037.Text = ""
pkp3_36110037.Text = ""
pkp4_36110037.Text = ""
pkp5_36110037.Text = ""
pph1_36110037.Text = ""
pph2_36110037.Text = ""
pph3_36110037.Text = ""
pph4_36110037.Text = ""
pph5_36110037.Text = ""
End Sub
End Class
8. Uji program dengan mengklik "Start Debugging".
9. Save program dengan mengklik icon "save".
10. Selesai.
Diposting oleh
Unknown
0 komentar:
Posting Komentar