Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

TUGAS 3 ERORR HEBBAT

Private Sub TbNA_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbNA.KeyPress
If Asc(e.keychar) = Keys.Enter Then
TbHrg.Focus()
End If

If Char.IsNumber(e.KEYCHAR) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True

End If

End Sub

Private Sub TbHrg_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbHrg.KeyPress
If Asc(e.keychar) = Keys.Enter Then
TbNs.Focus()
End If
If Char.IsLetter(e.KeyChar) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True
End If

End Sub

Private Sub TbNs_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbNs.KeyPress
If Asc(e.keychar) = Keys.Enter Then
TbUa.Focus()
End If
If Char.IsLetter(e.KeyChar) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True

End If

End Sub

Private Sub TbUa_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbUa.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
TbT.Focus()
End If
If Char.IsLetter(e.KeyChar) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True

End If

End Sub

Private Sub TbT_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbT.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
LblJlhp.Text = Val(TbUa.Text)
LblT.Text = Val(TbT.Text)
Me.TabControl1.SelectedIndex = 1
Me.Show()
TbJP.Focus()

End If
If Char.IsLetter(e.KeyChar) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True

End If
End Sub

Private Sub TbJP_keypress(sender As Object, e As KeyPressEventArgs) Handles


TbJP.KeyPress
If Char.IsLetter(e.KeyChar) Then
MsgBox("INPUT HARUS BERBENTUK HURUF!", MsgBoxStyle.Information, "INFORMASI")
e.Handled = True
End If

If Asc(e.KeyChar) = Keys.Enter Then


End If
Y = 1
THN = 1
Tahun = Val(TbT.Text)
Jdata = Val(LblJlhp.Text)
Jdata(x) = Val(TbJP.Text)
Pystn = Val(LblP.Text)
Nsisa = Val(LblNb.Text)
Hrgp = Val(TbHrg.Text)
Total = Total + Jlhp(x)
TPystn = (Hrgp - Nsisa) / Total

If x < Jdata Then


TbJP.Text = ""
x = x + 1

Else
Do While Y <= Jdata

LblT2.Text = LblT2.Text + Str(THN + Tahun - 1) + vbCrLf


LblJlhp2.Text = LblJlhp2.Text + Format(Jlhp(Y), "###,###") + vbCrLf

Pystn = Jlhp(Y) * TPystn : LblP.Text = LblP.Text + Format("###,###") +


vbCrLf
AKKP = AKKP + Pystn : Lblakumulasi.Text = Lblakumulasi.Text +
Format(Jlhp(Y), "###,###") + vbCrLf

Nsisa = Hrgp - AKKP : LblNb.Text = LblNb.Text + Format("###,###") +


vbCrLf
Tahun = Tahun + 1
Y = Y + 1
Loop
LblTotal.text = Format(Total, "###,###")
LblTPU.text = TP
LblT.Text = LblT2.Text + Format(Total, "###,###")
LblJlhp.Text = LblJlhp.Text + Format(Jlhp(Y), "###,###") + vbCrLf
Me.Show()
Me.TabControl1.SelectedIndex = 0
BtnHapus.Visible = True
End If

End Sub

Private Sub BtnSimpan_Click(sender As Object, e As EventArgs) Handles BtnSimpan.Click

THN = THN + 1
LblT.Text = LblT.Text + Str(THN) + vbCrLf
LblJlhp.Text = LblJlhp.Text + TbJP.Text + vbCrLf
LblP.Text = LblP.Text + Format("###,###") + vbCrLf

End Sub
End Class

You might also like