Program Skor Liga
pertama user diminta mengisi tim dan namanya. kemudian ia harus menginput jumlah kalah menang dan seri semua tim kemudian dia akan melihat hasil perolehan skornya
Kode classnya:
Public Class class_standing
Private nama
Public Function score(ByVal win As Integer, ByVal drawmatch As Integer)
score = (win * 3) + (drawmatch * 1)
End Function
Public Property nama_lain(ByVal nama As String)
Get
nama_lain = nama
End Get
Set(ByVal value)
nama = value
End Set
End Property
End Class
kode registration :
Public Class Form1
Private Sub inpuData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles inpuData.Click
Dim exten As New class_standing
If team.Text = "" Then
MsgBox("No team is selected !", MsgBoxStyle.Information, "No Team")
ElseIf nameuser.Text = "" Then
MsgBox("No user running the program !", MsgBoxStyle.Information, "No User")
nameuser.Focus()
Else
MsgBox("Hello " & exten.nama_lain(nameuser.Text) & " ! You have selected " & exten.nama_lain(team.Text) & " as your team")
Form2.Show()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Registration"
End Sub
End Class
kode form input :
Public Class Form2
Private Sub AW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AW.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub
Private Sub AD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AD.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub
Private Sub AL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AL.TextChanged
ATG.Text = Val(AW.Text) + Val(AL.Text) + Val(AD.Text)
End Sub
Private Sub CW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CW.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub
Private Sub CD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CD.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub
Private Sub CL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CL.TextChanged
CTG.Text = Val(CW.Text) + Val(CL.Text) + Val(CD.Text)
End Sub
Private Sub LW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LW.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub
Private Sub LD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LD.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub
Private Sub LL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LL.TextChanged
LTG.Text = Val(LW.Text) + Val(LL.Text) + Val(LD.Text)
End Sub
Private Sub MUW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUW.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub
Private Sub MUD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUD.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub
Private Sub MUL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MUL.TextChanged
MUTG.Text = Val(MUD.Text) + Val(MUW.Text) + Val(MUL.Text)
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Input"
Select Case Form1.team.Text
Case Is = "Arsenal"
Label1.ForeColor = Color.Cyan
Case Is = "Chelsea"
Label2.ForeColor = Color.Cyan
Case Is = "Liverpool"
Label3.ForeColor = Color.Cyan
Case Is = "Manchester United"
Label4.ForeColor = Color.Cyan
End Select
End Sub
Private Sub standing_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles standing.Click
Form3.Show()
End Sub
End Class
kode form score :
Public Class Form3
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "SCORE"
Dim winner As New class_standing
sc1.Text = winner.score(Form2.AW.Text, Form2.AD.Text)
sc2.Text = winner.score(Form2.CW.Text, Form2.CD.Text)
sc3.Text = winner.score(Form2.LW.Text, Form2.LD.Text)
sc4.Text = winner.score(Form2.MUW.Text, Form2.MUD.Text)
wt1.Text = Form2.AW.Text
wt2.Text = Form2.CW.Text
wt3.Text = Form2.LW.Text
wt4.Text = Form2.MUW.Text
d1.Text = Form2.AD.Text
d2.Text = Form2.CD.Text
d3.Text = Form2.LD.Text
d4.Text = Form2.MUD.Text
l1.Text = Form2.AL.Text
l2.Text = Form2.CL.Text
l3.Text = Form2.LL.Text
l4.Text = Form2.MUL.Text
End Sub
Private Sub gout_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gout.Click
End
End Sub
End Class