How to filter a bound DataGridView using a datetimepicker

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
Im really new to coding and Visual Basic, so please have this in mind and be gentle. Ive been looking for the past week how to filter the datagridview and have not been able to. Maybe Ive come across the answer, but didnt know it. I really need to see an example related to my code to actually be able to understand it, so please dont just tell me to go update the data source or whatnot. Please give step by step instructions and if possible explain it also.
Im using Visual Studio Pro 2010
Im able to Fill the datagridview with data from access database
im able to hide the columns i dont need
ive set the datagridview to fill with the datetimepicker on change command.
Im building (trying) a program that would store in a table Employee data (name, position, etc) and another table for worked hours, etc. the user would input a date in the datetimepicker and this would filter all the records for that date, later i would be adding more filters like a combobox with day and night shifts another one for department, etc., that way i would be able to enter all the employees that worked that date are in a certain department and worked the day or night shift.
Im not able to post images or links until my account is verified.
Thank You!Public Class frmParteDiarioPersonal

Private Sub frmParteDiarioPersonal_Load(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub DataGridView1_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs)

End Sub

Private Sub txtFecha_MaskInputRejected(sender As System.Object, e As System.Windows.Forms.MaskInputRejectedEventArgs)

End Sub

Private Sub txtDia_TextChanged(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub txtDepartamento_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub txtHSalida_MaskInputRejected(sender As System.Object, e As System.Windows.Forms.MaskInputRejectedEventArgs)

End Sub

Private Sub txtAtividad_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub txtHEntrada_MaskInputRejected(sender As System.Object, e As System.Windows.Forms.MaskInputRejectedEventArgs)

End Sub

Private Sub txtTurno_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub btnCargarPersonal_Click(sender As System.Object, e As System.EventArgs)

End Sub

Private Sub PartePersonalBindingSource_CurrentChanged(sender As System.Object, e As System.EventArgs) Handles PartePersonalBindingSource.CurrentChanged

End Sub

Private Sub txtDate_ValueChanged(sender As System.Object, e As System.EventArgs) Handles txtDate.ValueChanged
txtDia.Text = Convert.ToString(txtDate.Value.ToString("dddd"))
Me.PartePersonalTableAdapter.Fill(Me.PersonalObraNuevoDataSet.PartePersonal)
End Sub

Private Sub btnVolver_Click_1(sender As System.Object, e As System.EventArgs) Handles btnVolver.Click
Me.Close()
frmMain.Show()
End Sub

Private Sub txtCdEmpresa_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCdEmpresa.TextChanged

End Sub
Private Sub frmParteDiarioPersonal_Load_1(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
MessageBox.Show("You suck loser")
End Sub
End Class

View the full article
 
Back
Top