- Berikut desain form di Visual Studio :
- Dan dibawah ini Coding untuk form :
Public Class Form1
Private Sub Button1_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button1.Click
Dim
nilai, a, b, c, d As Integer
a = Val(TextBox3.Text)
b = Val(TextBox4.Text)
c = Val(TextBox5.Text)
d = Val(TextBox6.Text)
nilai = (a * 0.1) + (b * 0.15) + (c *
0.35) + (d * 0.4)
If
(nilai > 85) And (nilai <= 100) Then
MsgBox("Data
anda telah tersimpan", MsgBoxStyle.Information
+ MsgBoxStyle.OkOnly)
Label8.Visible = True
Label11.Visible = True
Label12.Visible = True
Label14.Visible = True
Label15.Visible = True
Label16.Visible = True
Label19.Visible = True
TextBox7.Visible = True
TextBox9.Visible = True
TextBox8.Visible = True
TextBox11.Visible = True
TextBox12.Visible = True
TextBox10.Visible = True
TextBox13.Visible = True
TextBox13.Text = "A"
TextBox10.Text = "Lulus"
ElseIf
(nilai > 70) And (nilai <= 85) Then
MsgBox("Data
anda telah tersimpan", MsgBoxStyle.Information
+ MsgBoxStyle.OkOnly)
Label8.Visible = True
Label11.Visible = True
Label12.Visible = True
Label14.Visible = True
Label15.Visible = True
Label16.Visible = True
Label19.Visible = True
TextBox7.Visible = True
TextBox9.Visible = True
TextBox8.Visible = True
TextBox11.Visible = True
TextBox12.Visible = True
TextBox10.Visible = True
TextBox13.Visible = True
TextBox13.Text = "B"
TextBox10.Text = "Lulus"
ElseIf
(nilai > 55) And (nilai <= 70) Then
MsgBox("Data
anda telah tersimpan", MsgBoxStyle.Information
+ MsgBoxStyle.OkOnly)
Label8.Visible = True
Label11.Visible = True
Label12.Visible = True
Label14.Visible = True
Label15.Visible = True
Label16.Visible = True
Label19.Visible = True
TextBox7.Visible = True
TextBox9.Visible = True
TextBox8.Visible = True
TextBox11.Visible = True
TextBox12.Visible = True
TextBox13.Visible = True
TextBox10.Visible = True
TextBox13.Text = "C"
TextBox10.Text = "Lulus"
ElseIf
(nilai > 40) And (nilai <= 55) Then
MsgBox("Mohon
maaf nilai anda belum mencapai kriteria lulus", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
ElseIf
(nilai > 0) And (nilai <= 40) Then
MsgBox("Mohon
maaf nilai anda belum mencapai kriteria lulus", MsgBoxStyle.Information + MsgBoxStyle.OkOnly)
End If
TextBox7.Text = TextBox1.Text
TextBox9.Text = ComboBox1.Text
TextBox8.Text = TextBox2.Text
TextBox11.Text = ComboBox3.Text
TextBox12.Text = Str(nilai)
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
Label8.Visible = False
Label11.Visible = False
Label12.Visible = False
Label14.Visible = False
Label15.Visible = False
Label16.Visible = False
Label19.Visible = False
TextBox7.Visible = False
TextBox9.Visible = False
TextBox8.Visible = False
TextBox11.Visible = False
TextBox12.Visible = False
TextBox13.Visible = False
TextBox10.Visible = False
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Button3.Click
Me.Close()
End Sub
End Class
Komentar
Posting Komentar