Simple Lottery Game (Guna UI) VB.NET

Simple Lottery Game (Guna UI) VB.NET


Guna UI Download : https://gunaframework.com/

FORM 1
Public Class Form2
    Dim R1, R2, R3 As New Random
    Dim PHP As Double = R1.Next(1, 999)

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim formattedValue As String = String.Format("{0:C}", PHP)
        Label5.Text = formattedValue

    End Sub
    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        'Random Generator

        Label1.Text = R1.Next(1, 3)

    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        'Random Generator

        Label2.Text = R2.Next(1, 5)

    End Sub

    Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
        'Random Generator

        Label3.Text = R3.Next(1, 9)

    End Sub

    Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
        If Me.GunaProgressBar1.Value = 1000 Then
            GunaTextBox6.Enabled = True
            GunaTextBox3.Enabled = True
            GunaTextBox5.Enabled = True
            GunaTextBox2.Enabled = True
            GunaTextBox4.Enabled = True
            GunaTextBox1.Enabled = True
            GunaAdvenceButton1.Enabled = True
            GunaAdvenceButton2.Enabled = True
            GunaAdvenceButton3.Enabled = True


            GunaTextBox6.Visible = True
            GunaTextBox3.Visible = True
            GunaTextBox5.Visible = True
            GunaTextBox2.Visible = True
            GunaTextBox4.Visible = True
            GunaTextBox1.Visible = True
            GunaAdvenceButton1.Visible = True
            GunaAdvenceButton2.Visible = True
            GunaAdvenceButton3.Visible = True


            GunaTextBox4.Text = Nothing
            GunaTextBox1.Text = Nothing
            GunaTextBox6.Text = Nothing
            GunaTextBox3.Text = Nothing
            GunaTextBox2.Text = Nothing
            GunaTextBox5.Text = Nothing

            Me.GunaProgressBar1.Value = 0
            Timer1.Stop()
            Timer2.Stop()
            Timer3.Stop()
            Timer4.Stop()
        Else
            Me.GunaProgressBar1.Value = Me.GunaProgressBar1.Value + 1
        End If

        If Me.GunaProgressBar1.Value = 200 Then

            Timer3.Stop()
            If Label3.Text = GunaTextBox3.Text Then
                GunaTextBox3.Text = Nothing
                Dim price As Double
                price = GunaTextBox6.Text
                price = price * 50
                PHP = PHP + price
                Dim formattedValue As String = String.Format("{0:C}", PHP)
                Label5.Text = formattedValue


                Me.GunaProgressBar1.Value = 0
                Timer1.Stop()
                Timer2.Stop()
                Timer3.Stop()
                Timer4.Stop()

                GunaTextBox6.Enabled = True
                GunaTextBox3.Enabled = True
                GunaTextBox5.Enabled = True
                GunaTextBox2.Enabled = True
                GunaTextBox4.Enabled = True
                GunaTextBox1.Enabled = True
                GunaAdvenceButton1.Enabled = True
                GunaAdvenceButton2.Enabled = True
                GunaAdvenceButton3.Enabled = True


                GunaTextBox6.Visible = True
                GunaTextBox3.Visible = True
                GunaTextBox5.Visible = True
                GunaTextBox2.Visible = True
                GunaTextBox4.Visible = True
                GunaTextBox1.Visible = True
                GunaAdvenceButton1.Visible = True
                GunaAdvenceButton2.Visible = True
                GunaAdvenceButton3.Visible = True


                GunaTextBox4.Text = Nothing
                GunaTextBox1.Text = Nothing
                GunaTextBox6.Text = Nothing
                GunaTextBox3.Text = Nothing
                GunaTextBox2.Text = Nothing
                GunaTextBox5.Text = Nothing
                MsgBox("You won " & price, MsgBoxStyle.OkOnly)
            End If

        ElseIf Me.GunaProgressBar1.Value = 500 Then

            Timer2.Stop()
            If Label2.Text = GunaTextBox2.Text Then
                GunaTextBox2.Text = Nothing
                Dim price As Double
                price = GunaTextBox5.Text
                price = price * 20
                PHP = PHP + price
                Dim formattedValue As String = String.Format("{0:C}", PHP)
                Label5.Text = formattedValue


                Me.GunaProgressBar1.Value = 0
                Timer1.Stop()
                Timer2.Stop()
                Timer3.Stop()
                Timer4.Stop()

                GunaTextBox6.Enabled = True
                GunaTextBox3.Enabled = True
                GunaTextBox5.Enabled = True
                GunaTextBox2.Enabled = True
                GunaTextBox4.Enabled = True
                GunaTextBox1.Enabled = True
                GunaAdvenceButton1.Enabled = True
                GunaAdvenceButton2.Enabled = True
                GunaAdvenceButton3.Enabled = True


                GunaTextBox6.Visible = True
                GunaTextBox3.Visible = True
                GunaTextBox5.Visible = True
                GunaTextBox2.Visible = True
                GunaTextBox4.Visible = True
                GunaTextBox1.Visible = True
                GunaAdvenceButton1.Visible = True
                GunaAdvenceButton2.Visible = True
                GunaAdvenceButton3.Visible = True


                GunaTextBox4.Text = Nothing
                GunaTextBox1.Text = Nothing
                GunaTextBox6.Text = Nothing
                GunaTextBox3.Text = Nothing
                GunaTextBox2.Text = Nothing
                GunaTextBox5.Text = Nothing
                Dim formattedValue1 As String = String.Format("{0:C}", price)
                MsgBox("You won " & formattedValue1, MsgBoxStyle.OkOnly)
            End If

        ElseIf Me.GunaProgressBar1.Value = 1000 Then

            Timer1.Stop()
            If Label1.Text = GunaTextBox1.Text Then
                GunaTextBox1.Text = Nothing
                Dim price As Double
                price = GunaTextBox4.Text
                price = price * 10
                PHP = PHP + price
                Dim formattedValue As String = String.Format("{0:C}", PHP)
                Label5.Text = formattedValue


                Me.GunaProgressBar1.Value = 0
                Timer1.Stop()
                Timer2.Stop()
                Timer3.Stop()
                Timer4.Stop()

                GunaTextBox6.Enabled = True
                GunaTextBox3.Enabled = True
                GunaTextBox5.Enabled = True
                GunaTextBox2.Enabled = True
                GunaTextBox4.Enabled = True
                GunaTextBox1.Enabled = True
                GunaAdvenceButton1.Enabled = True
                GunaAdvenceButton2.Enabled = True
                GunaAdvenceButton3.Enabled = True


                GunaTextBox6.Visible = True
                GunaTextBox3.Visible = True
                GunaTextBox5.Visible = True
                GunaTextBox2.Visible = True
                GunaTextBox4.Visible = True
                GunaTextBox1.Visible = True
                GunaAdvenceButton1.Visible = True
                GunaAdvenceButton2.Visible = True
                GunaAdvenceButton3.Visible = True


                GunaTextBox4.Text = Nothing
                GunaTextBox1.Text = Nothing
                GunaTextBox6.Text = Nothing
                GunaTextBox3.Text = Nothing
                GunaTextBox2.Text = Nothing
                GunaTextBox5.Text = Nothing
                Dim formattedValue1 As String = String.Format("{0:C}", price)
                MsgBox("You won " & formattedValue1, MsgBoxStyle.OkOnly)
            End If

        End If
    End Sub

    Private Sub GunaAdvenceButton1_Click(sender As Object, e As EventArgs) Handles GunaAdvenceButton1.Click
        Dim amount As Double = 0
        amount = GunaTextBox4.Text
        If amount > PHP Then
            MsgBox("insufficient fund")
            Return
        Else
            GunaTextBox3.Text = Nothing
            GunaTextBox2.Text = Nothing
            GunaTextBox5.Text = Nothing
            GunaTextBox6.Text = Nothing

            GunaTextBox6.Enabled = False
            GunaTextBox3.Enabled = False
            GunaTextBox5.Enabled = False
            GunaTextBox2.Enabled = False
            GunaTextBox4.Enabled = False
            GunaTextBox1.Enabled = False
            GunaAdvenceButton1.Enabled = False
            GunaAdvenceButton2.Enabled = False
            GunaAdvenceButton3.Enabled = False

            GunaTextBox6.Visible = False
            GunaTextBox3.Visible = False
            GunaTextBox5.Visible = False
            GunaTextBox2.Visible = False
            GunaTextBox4.Visible = False
            GunaTextBox1.Visible = True
            GunaAdvenceButton1.Visible = False
            GunaAdvenceButton2.Visible = False
            GunaAdvenceButton3.Visible = False

            PHP = PHP - Me.GunaTextBox4.Text
            Dim formattedValue As String = String.Format("{0:C}", PHP)
            Label5.Text = formattedValue
            Me.GunaProgressBar1.Value = 0
            Timer1.Start()
            Timer2.Start()
            Timer3.Start()
            Timer4.Start()
        End If

    End Sub

    Private Sub GunaAdvenceButton2_Click(sender As Object, e As EventArgs) Handles GunaAdvenceButton2.Click
        Dim amount As Double = 0
        amount = CInt(GunaTextBox5.Text)
        If amount > PHP Then
            MsgBox("insufficient fund")
            Return
        Else
            GunaTextBox4.Text = Nothing
            GunaTextBox1.Text = Nothing
            GunaTextBox6.Text = Nothing
            GunaTextBox3.Text = Nothing

            GunaTextBox6.Enabled = False
            GunaTextBox3.Enabled = False
            GunaTextBox5.Enabled = False
            GunaTextBox2.Enabled = False
            GunaTextBox4.Enabled = False
            GunaTextBox1.Enabled = False
            GunaAdvenceButton1.Enabled = False
            GunaAdvenceButton2.Enabled = False
            GunaAdvenceButton3.Enabled = False

            GunaTextBox6.Visible = False
            GunaTextBox3.Visible = False
            GunaTextBox5.Visible = False
            GunaTextBox2.Visible = True
            GunaTextBox4.Visible = False
            GunaTextBox1.Visible = False
            GunaAdvenceButton1.Visible = False
            GunaAdvenceButton2.Visible = False
            GunaAdvenceButton3.Visible = False

            PHP = PHP - Me.GunaTextBox5.Text
            Dim formattedValue As String = String.Format("{0:C}", PHP)
            Label5.Text = formattedValue
            Me.GunaProgressBar1.Value = 0
            Timer1.Start()
            Timer2.Start()
            Timer3.Start()
            Timer4.Start()
        End If

    End Sub

    Private Sub GunaAdvenceButton3_Click(sender As Object, e As EventArgs) Handles GunaAdvenceButton3.Click
        Dim amount As Double = 0
        amount = (GunaTextBox6.Text)
        If amount > PHP Then
            MsgBox("insufficient fund")
            Return
        Else

            GunaTextBox5.Text = Nothing
            GunaTextBox2.Text = Nothing
            GunaTextBox4.Text = Nothing
            GunaTextBox1.Text = Nothing

            GunaTextBox6.Enabled = False
            GunaTextBox3.Enabled = False
            GunaTextBox5.Enabled = False
            GunaTextBox2.Enabled = False
            GunaTextBox4.Enabled = False
            GunaTextBox1.Enabled = False
            GunaAdvenceButton1.Enabled = False
            GunaAdvenceButton2.Enabled = False
            GunaAdvenceButton3.Enabled = False

            GunaTextBox6.Visible = False
            GunaTextBox3.Visible = True
            GunaTextBox5.Visible = False
            GunaTextBox2.Visible = False
            GunaTextBox4.Visible = False
            GunaTextBox1.Visible = False
            GunaAdvenceButton1.Visible = False
            GunaAdvenceButton2.Visible = False
            GunaAdvenceButton3.Visible = False

            PHP = PHP - Me.GunaTextBox6.Text
            Dim formattedValue As String = String.Format("{0:C}", PHP)
            Label5.Text = formattedValue
            Me.GunaProgressBar1.Value = 0
            Timer1.Start()
            Timer2.Start()
            Timer3.Start()
            Timer4.Start()
        End If

    End Sub
End Class

Comments

Popular posts from this blog

QR CODE SCANNER (Emgu CV ) VB.NET

Simple Modern Login (Guna UI, Mysql) VB.NET