Hi friends!
I have a problem when I search in datagridview with DateTimePicker1, DateTimePicker2, Textbox1.
DateTimePicker1 : DATE_FROM
DateTimePicker2 : DATE_TO
Textbox1 : NUMBER_RECEIPT
I choose DateTimePicker1 from 01/01/2017 and DateTimePicker2 to 25/09/2017 and show:
| NUMBER_RECEIPT | DATE | DESCRIPTIONS |
| 12 | 12/09/2017 | Item 14 |
| 12 | 12/09/2017 | Item 15 |
| 13 | 17/09/2017 | Item 23 |
| 14 | 25/09/2017 | Item 31 |
When I choose DateTimePicker1 from 17/09/2017 and DateTimePicker2 to 25/09/2017 show:
| NUMBER_RECEIPT | DATE | DESCRIPTIONS |
| 13 | 17/09/2017 | Item 23 |
| 14 | 25/09/2017 | Item 31 |
My problem showed when I search with
Textbox1 after choose date from 17/09/2017 to 25/09/2017:
12
| NUMBER_RECEIPT | DATE | DESCRIPTIONS |
| 12 | 12/09/2017 | Item 14 |
| 12 | 12/09/2017 | Item 15 |
NUMBER_RECEIPT 12 is not from 17/09/2017 to 25/09/2017 .
What I have tried:
I tried different way but without result.
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
Select Case e.KeyCode
Case Keys.Enter
BindingSource18.Filter = "[NUMBER_RECEIPT] LIKE '" & TextBox1.Text & "%'"
End Select
End Sub
Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Me.BindingSource18.Filter = "DATE_FROM >= '" & DateTimePicker1.Text & "' and DATE_TO <= '" & DateTimePicker2.Text & "'"
End Sub
Private Sub DateTimePicker2_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker2.ValueChanged
Me.BindingSource18.Filter = "DATE_FROM >= '" & DateTimePicker1.Text & "' and DATE_TO <= '" & DateTimePicker2.Text & "'"
End Sub
Please can you help me? THANKS :)