Module usuableselect

    Dim cmd As New OleDb.OleDbCommand
    Dim da, dcb As New OleDb.OleDbDataAdapter

    Dim dc As New DataColumn

    Public total As Integer

 

    Dim tt As New ToolTip With {.IsBalloon = True}

    Dim dt As New DataTable

   
    Public Sub ejbselect(ByVal sql As String)
        Try
            con.Open()
            With cmd
                .Connection = con
                .CommandText = sql
            End With

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Exclamation)
        End Try
        con.Close()
        da.Dispose()
    End Sub



    Public Sub fillcombobox(ByVal cb As Object)

        Dim cbcatgorytbl As New DataTable
        dcb.SelectCommand = cmd

        Try
            dcb.Fill(cbcatgorytbl)


            cbcatgorytbl.Rows.Add("-------------Select Candidate--------------")

            With cb

                .DataSource = cbcatgorytbl
                .DisplayMember = " "
                .ValueMember = "cand_name"
                .SelectedValue = "-------------Select Candidate--------------"

            End With

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub




    Public Sub newclearall(ByVal group As Object, ByVal cleardtg As Object)
        For Each ctrl As Control In group.Controls
            If ctrl.GetType Is GetType(TextBox) Then
                ctrl.Text = Nothing
                cleardtg.DataSource = Nothing
            End If
        Next
    End Sub

    Public Sub filluser(ByVal dtgrd As Object)

        Dim publictable As New DataTable



        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).Visible = False
            dtgrd.Columns(3).Visible = False

        Catch ex As Exception

        End Try

    End Sub


    Public Sub fillcandidate(ByVal dtgrd As Object)

        Dim publictable As New DataTable
        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).Visible = False
            dtgrd.Columns(6).Visible = False
            dtgrd.Columns(8).Visible = False
            dtgrd.Columns(9).Visible = False
            dtgrd.Columns(10).Visible = False

            'dtgrd.Columns(1).width = 150
            'dtgrd.Columns(2).width = 150
            'dtgrd.Columns(3).width = 100

            da.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub

    Public Sub fillcandidateScore(ByVal dtgrd As Object)

        Dim publictable As New DataTable
        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).width = 150
            dtgrd.Columns(1).width = 100
            dtgrd.Columns(2).width = 100

            da.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub

    Public Sub fillVoters(ByVal dtgrd As Object)
        Dim publictable As New DataTable
        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).Visible = False
            dtgrd.Columns(8).Visible = False
            dtgrd.Columns(9).Visible = False
            dtgrd.Columns(7).width = 150
            'dtgrd.Columns(4).Visible = False

            da.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub

    Public Sub fillVoters2(ByVal dtgrd As Object)
        Dim publictable As New DataTable
        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).Visible = False
            dtgrd.Columns(1).width = 150
            dtgrd.Columns(2).width = 150
            dtgrd.Columns(3).width = 100
            dtgrd.Columns(3).width = 100

            da.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub

    Public Sub fillVoters3(ByVal dtgrd As Object)
        Dim publictable As New DataTable
        Try
            da.SelectCommand = cmd
            da.Fill(publictable)
            dtgrd.DataSource = publictable

            dtgrd.Columns(0).Visible = False
            dtgrd.Columns(3).width = 150
            dtgrd.Columns(4).width = 150

            da.Dispose()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information)
        End Try

    End Sub


   








    Public Sub clearall(ByVal group As Object, ByVal cleardtg As Object)
        For Each ctrl As Control In group.Controls
            If ctrl.GetType Is GetType(TextBox) Then
                ctrl.Text = Nothing
                cleardtg.DataSource = Nothing
            End If
        Next
    End Sub


    'Public Sub newclearall(ByVal group As Object, ByVal cleardtg As Object)
    '    For Each ctrl As Control In group.Controls
    '        If ctrl.GetType Is GetType(TextBox) Then
    '            ctrl.Text = Nothing
    '            cleardtg.DataSource = Nothing
    '        End If
    '    Next
    'End Sub


    Public Sub cleartext(ByVal group As Object)
        For Each ctrl As Control In group.Controls
            If ctrl.GetType Is GetType(TextBox) Then
                ctrl.Text = Nothing

            End If
        Next
    End Sub


End Module
