使用DateTimePacker的DataBinding过滤器 [英] DataBinding Filter with DateTimePacker

查看:80
本文介绍了使用DateTimePacker的DataBinding过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

我需要帮助

我做小程序但是datagridview中过滤数据的问题

我使用数据绑定与datetimepacker(我需要两个日期之间的数据)



Hello
I need help
I make small program but the problem in filter data in datagridview
I use databinding with datetimepacker (I need data between tow dates)

Dim T1 As Date
Dim T2 As Date
T1 = Convert.ToDateTime(Me.DateTimePicker1.Value)
T2 = Convert.ToDateTime(Me.DateTimePicker2.Value)
Me.T1BindingSource.Filter = "_Date >= #T1#  AND _Date <= #T2#"







但是有错误

字符串未被识别为有效的DateTime。从索引0开始有一个未知单词。

任何人都可以帮助我吗?




but there is an error
The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.
can anyone help me ?

推荐答案

字符串未被识别为有效的DateTime。从索引0开始有一个未知单词。

首先,它看起来像一个代码行,如

The string was not recognized as a valid DateTime. There is a unknown word starting at index 0.
To start with, it looks like one of the code lines like
Convert.ToDateTime(Me.DateTimePicker1.Value)



投掷相同。基于错误,该值为空或者不是可以转换为Datetime的格式。

确保您拥有有效的转换日期时间值。



继续前进,形成的过滤条件应该符合预期。使用VS DEBUGGER跟踪和查看工作流程和值。


is throwing the same. Based on error, the value is either empty or not in a format that can be converted into a Datetime.
Make sure, you have a valid datetime value for conversion.

Moving ahead, the filter criteria formed should be proper as expected. Use VS DEBUGGER to track and see the workflow and values.


这篇关于使用DateTimePacker的DataBinding过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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