Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
VB
<pre>   dtFilterStartDate = "01/" & DtpMonth.Value.Month & "/" & DtpYear.Value.Year & ""
        dtFilterEndDate = dtFilterStartDate.AddMonths(1)

        intEmployee = CmbxEmployeeFilter.SelectedValue

        AttendanceViewerDataGrid(DgvAttendanceTimesViewer, TblEmployeesBindingSource)

        BsAttendanceTimes.DataSource = AttendanceTimesViewerDataTable(intEmployee)

        DgvAttendanceTimesViewer.DataSource = BsAttendanceTimes

        BsAttendanceTimes.Filter = "ClockDate >= '" & dtFilterStartDate &"'      
        and ClockDate < '" & dtFilterEndDate & "'"
        BsAttendanceTimes.EndEdit()


This my code that runs every time an Employee is selected in a ComboBox, It uses the Month and Year values from separate DateTimePickers to filter the results. I wondered if there was a faster way, or better way to do this.

What I have tried:

I couldn't really think of any better way that filling a DataTable with the Employees Data then Filter it and display it.
Posted
Updated 21-Apr-17 14:38pm
v3
Comments
CHill60 22-Apr-17 13:23pm    
Personally I would filter the data before populating the Data table (or Control)...using a WHERE

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900