Click here to Skip to main content
11,647,748 members (64,826 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET databse
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#"
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 ?
Posted 5-Jan-13 10:54am
kosay851.3K
Edited 5-Jan-13 10:57am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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)
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.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 jyo.net 500
1 F-ES Sitecore 410
2 OriginalGriff 322
3 DamithSL 315
4 CPallini 290
0 OriginalGriff 1,342
1 jyo.net 994
2 DamithSL 971
3 Sergey Alexandrovich Kryukov 873
4 CPallini 795


Advertise | Privacy | Mobile
Web03 | 2.8.150804.3 | Last Updated 6 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100