在日期之间过滤datagridview [英] Filter a datagridview between dates

查看:75
本文介绍了在日期之间过滤datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要过滤日期和时间之间的datagridview

我所拥有的是开始和结束日期以及开始和结束时间.在我的表单上,我有一个日期文本框和时间,它们是当前时间和日期.因此,当表单打开时,我想过滤datagridview,其中enddate小于或等于日期文本框,然后starttime和endtime在时间文本框之间.到目前为止我有这个

I need to filter a datagridview between dates and times

What I have is a start and End Date and start and end time. On my form I have a date textbox and time that are the current time and date. So when the form opens I want to filter the datagridview where the enddate is less than or equal to the date textbox and then starttime and endtime are between the time textbox. I have this so far

Dim value10 As String = Me.DateTextBox.Text
        Dim value11 As String = Me.TimeTextBox.Text



Me.TblShiftBindingSource.Filter ="StartDate< =''"&值10& "和EndDate> ="&值10& "和StartTime< ="& value11& "和EndTime>"& value11& ""



Me.TblShiftBindingSource.Filter = "StartDate <= ''" & value10 & "'' and EndDate >= ''" & value10 & "'' and StartTime <= ''" & value11 & "'' and EndTime > ''" & value11 & "''"

推荐答案

这里是一个示例:
使用BindingSource和DataView过滤在DataGridView中显示的数据 [
Here is an example:
Filter data dispalyed in a DataGridView using BindingSource and DataView[^]

Hope it helps.
Regards
Espen Harlinn


这篇关于在日期之间过滤datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆