Public Class frmBallot

    Private Sub frmBallot_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'President' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox1)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'Vice-President' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox2)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'Secretary' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox3)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'Treasurer' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox4)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'Auditor' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox5)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'PIO' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox6)

        ejbselect("select distinct [cand_name] from tblCandidate where candidacy = 'Senator' and a_y ='" & frmAy.ComboBox1.Text & "'")
        fillcombobox(ComboBox7)

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim sql As String

        sql = "select * from tblCandidate where cand_name ='" & lblPres.Text & "'"
        ejbfindthis(sql)
        VoteScore()

        sql = "select * from tblCandidate where cand_name ='" & lblVpre.Text & "'"
        ejbfindthis(sql)
        VoteScore()

        sql = "select * from tblCandidate where cand_name ='" & lblSec.Text & "'"
        ejbfindthis(sql)
        VoteScore()


        sql = "select * from tblCandidate where cand_name ='" & lbltres.Text & "'"
        ejbfindthis(sql)
        VoteScore()

        sql = "select * from tblCandidate where cand_name ='" & lblaud.Text & "'"
        ejbfindthis(sql)
        VoteScore()

        sql = "select * from tblCandidate where cand_name ='" & lblpio.Text & "'"
        ejbfindthis(sql)
        VoteScore()

        sql = "select * from tblCandidate where cand_name ='" & lblsen.Text & "'"
        ejbfindthis(sql)
        VoteScore()
        Me.Close()
        frmRegistration.Show()
        MsgBox("Congratulations your vote is counted THANK YOU!")


    End Sub

    Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged

        lblPres.Text = ComboBox1.Text

    End Sub

    Private Sub ComboBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox2.TextChanged
        lblVpre.Text = ComboBox2.Text
    End Sub

    Private Sub ComboBox3_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox3.TextChanged
        lblSec.Text = ComboBox3.Text
    End Sub

    Private Sub ComboBox4_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox4.TextChanged
        lbltres.Text = ComboBox4.Text
    End Sub

    Private Sub ComboBox5_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox5.TextChanged
        lblaud.Text = ComboBox5.Text
    End Sub

   
    Private Sub ComboBox6_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox6.TextChanged
        lblpio.Text = ComboBox6.Text
    End Sub

    Private Sub ComboBox7_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox7.TextChanged
        lblsen.Text = ComboBox7.Text
    End Sub
End Class