Imports System.Data.OleDb

Module Module1
    Public OleCn As New OleDbConnection()
    Public DtaSet As New DataSet()
    Public OleDa As New OleDbDataAdapter()

    Public Function StrConnection() As String
        'StrConnection = "Data Source=MOHAMMED;Initial Catalog=Project;User ID=sa;Password=ali123;"
        StrConnection = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=" & My.Application.Info.DirectoryPath.ToString() & "\BackUp\Printmaker11.accdb"
        Return StrConnection
    End Function

    Dim serialno As New DataGridViewTextBoxColumn()
    Dim Dat As New DataGridViewTextBoxColumn()
    Dim CabinNo As New DataGridViewTextBoxColumn()
    Dim name As New DataGridViewTextBoxColumn()
    Dim IDProof As New DataGridViewTextBoxColumn()
    ' Dim IDNo As New DataGridViewTextBoxColumn()
    Dim Logintime As New DataGridViewTextBoxColumn()
    Dim Logouttime As New DataGridViewTextBoxColumn()
    Dim duration As New DataGridViewTextBoxColumn()
    Dim amount As New DataGridViewTextBoxColumn()
    Dim Particular As New DataGridViewTextBoxColumn()

    Public Sub GridView(ByVal dgv As DataGridView)
        dgv.AutoGenerateColumns = False
        With serialno
            .DataPropertyName = "SerialNo"
            .HeaderText = "Serial No"
            .Width = 50
        End With
        With Dat
            .DataPropertyName = "Dat"
            .HeaderText = "Date"
            .Width = 80
        End With
        With CabinNo
            .DataPropertyName = "CabinNo"
            .HeaderText = "Cabin No"
            .Width = 50
        End With
        With name
            .DataPropertyName = "CustomerName"
            .HeaderText = "Customer Name"
            .Width = 175
        End With
        With IDProof
            .DataPropertyName = "ID_Proof"
            .HeaderText = "ID Proof"
            .Width = 130
        End With
        '  With IDNo
        '.DataPropertyName = "ID_Number"
        '.HeaderText = "ID Number"
        '.Width = 120
        ' End With
        With Logintime
            .DataPropertyName = "LoginTime"
            .HeaderText = "Login Time"
            .Width = 85
        End With
        With Logouttime
            .DataPropertyName = "LogoutTime"
            .HeaderText = "Logout Time"
            .Width = 85
        End With
        With duration
            .DataPropertyName = "Duration"
            .HeaderText = "Duration"
            .Width = 75
        End With
        With amount
            .DataPropertyName = "Amount"
            .HeaderText = "Amount"
            .Width = 60
        End With
        With Particular
            .DataPropertyName = "Particular"
            .HeaderText = "Particular"
            .Width = 140
        End With


        With dgv
            .DataSource = DtaSet
            .DataMember = "Table1"
            .ReadOnly = True
            .MultiSelect = False
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .ShowRowErrors = False
            .ShowCellErrors = False
            .AllowUserToAddRows = False ' Disabled or hide (*) Symbol...
            .AllowUserToResizeColumns = False 'Disable HearderText Resize Column...
            .AllowUserToResizeRows = False 'Disabled  row resize...
            .RowHeadersVisible = False 'To hide Left indicator...
            .DefaultCellStyle.SelectionBackColor = Color.SteelBlue  'Selection backcolor....
            .AlternatingRowsDefaultCellStyle.BackColor = Color.LightGoldenrodYellow 'Alternating Backcolor
            .Columns.AddRange(New DataGridViewColumn() {serialno, Dat, CabinNo, name, IDProof, Logintime, Logouttime, duration, amount, Particular})

            ' .Columns(2).DefaultCellStyle.Format = "dd/MM/yyyy"
            ' .Columns(8).DefaultCellStyle.Format = "dd/MM/yyyy"

        End With
    End Sub




    Dim serialno2 As New DataGridViewTextBoxColumn()
    Dim Dat2 As New DataGridViewTextBoxColumn()
    Dim CabinNo2 As New DataGridViewTextBoxColumn()
    Dim name2 As New DataGridViewTextBoxColumn()
    Dim IDProof2 As New DataGridViewTextBoxColumn()
    ' Dim IDNo As New DataGridViewTextBoxColumn()
    Dim Logintime2 As New DataGridViewTextBoxColumn()
    Dim Logouttime2 As New DataGridViewTextBoxColumn()
    Dim duration2 As New DataGridViewTextBoxColumn()
    Dim amount2 As New DataGridViewTextBoxColumn()
    Dim Particular2 As New DataGridViewTextBoxColumn()
    Dim RecSelection2 As New DataGridViewCheckBoxColumn

    Public Sub GridView2(ByVal dgv2 As DataGridView)
        dgv2.AutoGenerateColumns = False

        With RecSelection2
            .DataPropertyName = "RecordSelection"
            .HeaderText = ""
            .Width = 55
        End With

        With serialno2
            .DataPropertyName = "SerialNo"
            .HeaderText = "Serial No"
            .Width = 45
        End With
        With Dat2
            .DataPropertyName = "Dat"
            .HeaderText = "Date"
            .Width = 85
        End With
        With CabinNo2
            .DataPropertyName = "CabinNo"
            .HeaderText = "Cabin No"
            .Width = 45
        End With
        With name2
            .DataPropertyName = "CustomerName"
            .HeaderText = "Customer Name"
            .Width = 155
        End With
        With IDProof2
            .DataPropertyName = "ID_Proof"
            .HeaderText = "ID Proof"
            .Width = 130
        End With
        With Logintime2
            .DataPropertyName = "LoginTime"
            .HeaderText = "Login Time"
            .Width = 85
        End With
        With Logouttime2
            .DataPropertyName = "LogoutTime"
            .HeaderText = "Logout Time"
            .Width = 85
        End With
        With duration2
            .DataPropertyName = "Duration"
            .HeaderText = "Duration"
            .Width = 75
        End With
        With amount2
            .DataPropertyName = "Amount"
            .HeaderText = "Amount"
            .Width = 60
        End With
        With Particular2
            .DataPropertyName = "Particular"
            .HeaderText = "Particular"
            .Width = 110
        End With

        With dgv2
            .DataSource = DtaSet
            .DataMember = "Table1"
            .ReadOnly = True
            .MultiSelect = False
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect
            .ShowRowErrors = False
            .ShowCellErrors = False
            .AllowUserToAddRows = False ' Disabled or hide (*) Symbol...
            .AllowUserToResizeColumns = False 'Disable HearderText Resize Column...
            .AllowUserToResizeRows = False 'Disabled  row resize...
            .RowHeadersVisible = False 'To hide Left indicator... 
            .DefaultCellStyle.SelectionBackColor = Color.SteelBlue  'Selection backcolor....
            .AlternatingRowsDefaultCellStyle.BackColor = Color.LightGoldenrodYellow 'Alternating Backcolor
            .Columns.AddRange(New DataGridViewColumn() {RecSelection2, serialno2, Dat2, CabinNo2, name2, IDProof2, Logintime2, Logouttime2, duration2, amount2, Particular2})
        End With
    End Sub
End Module
