Kamis, 27 September 2012

Ujian TIK

Yak, udah lama gak ngepost ngepost pas lagi leha2 H-1 ujian vb pasti pada mager bgt ngoding-_- nih ada ane dah bikin semoga membantu uhuk. Bisa dipelajari benar2 ya. waktunya dikit suruh buat satu program..Tapi ini gue bikinnya pake visual basic express edition -_- pirates pula-_- trial pulaaa yang diujikan itu VB 6.0 ya-_- beda sama yang ini kodingannya juga byk yg beda but selo asal ngerti logikanya ya. wiss monggo belajar kabeh.
Download disini!


Public Class Form1

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        MsgBox("Your current credit is " & Val(TextBox7.Text) & ". Your final score is " & Val(TextBox5.Text))
        End
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = False
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If Timer1.Enabled = False Then
            Timer1.Enabled = True
            Button1.Text = "Stop"
        Else
            Timer1.Enabled = False
            Button1.Text = "Spin!"
        End If
        If Timer1.Enabled = False And TextBox1.Text = "7" Or TextBox2.Text = "7" Or TextBox3.Text = "7" Then
            TextBox8.Text = "Great! Lucky Seven!"
        Else
            TextBox8.Text = "Sorry! Spin again!"
        End If
     
        If Button1.Text = "Stop" Then
            TextBox8.Text = ""
            TextBox5.Text = Val(TextBox5.Text) + 0
            TextBox7.Text = Val(TextBox7.Text) - 5
        End If
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        TextBox1.Text = Int(Rnd() * 10)
        TextBox2.Text = Int(Rnd() * 10)
        TextBox3.Text = Int(Rnd() * 10)
    End Sub

    Private Sub TextBox8_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox8.TextChanged
        If TextBox8.Text = "Sorry! Spin again!" And Timer1.Enabled = False Then
            TextBox5.Text = Val(TextBox5.Text) - 5
        End If
        If TextBox8.Text = "Great! Lucky Seven!" And Timer1.Enabled = False Then
            TextBox5.Text = Val(TextBox5.Text) + 10
        End If
    End Sub

    Private Sub TextBox7_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox7.TextChanged
        If TextBox7.Text <= 0 Then
            MsgBox("Sorry, your credit has elapsed. Your final score is " & Val(TextBox5.Text))
            End

        End If


    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub
End Class

Tidak ada komentar:

Posting Komentar