none
Filter datagridview and get rid of Date RRS feed

  • Domanda

  • Hi guys I have a very big problem,

    I have two columns in my Table and are both datetime type, now I want my gridview to filter between time values without checking for the date.

    but something goes wrong, example:

    If I add today 29/09/2014 two records it works but as the day goes over my filter is blank because it checks also for date.

    this is my code:

    If TextBox6.Text <> "" And TextBox5.Text <> "" Then
                Dim Entrata, Uscita As New DateTime
                DateTime.TryParse(TextBox6.Text, Entrata)
                DateTime.TryParse(TextBox5.Text, Uscita)
                AnagraficaBindingSource.Filter = String.Format("[Orario di lavoro da] = #{0}# AND [Orario di lavoro a] = #{1}#", Entrata.ToString("HH:mm"), Uscita.ToString("HH:mm"))
            Else
                MsgBox("Inserire l'orario di lavoro", MsgBoxStyle.OkOnly, "Orario di lavoro necessario")
            End If
            TextBox6.Clear()
            TextBox5.Clear()

    Is there a way to get rid of the date? Thank you all

    lunedì 29 settembre 2014 17:49