Date Problem with PropertyGridItemDate |
Post Reply |
Author | |
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
Posted: 06 February 2008 at 12:47pm |
I am using VB6 with CJ 11.2.2
Here is the code: Dim DateItem As PropertyGridItemDate Set DateItem = Category.AddChildItem(PropertyItemDate, "Due Date", "12/30/2000") DateItem.Format = "%m%d%Y" Debug.Print Month(CDate("2 / 2 / 2008")) DateItem.Month = Month(CDate("2 / 2 / 2008")) with the debug line the Month returns 2 properly. However, the DateItem.Month value is returning -1 after it is assigned Month(CDate("2 / 2 / 2008")). It will also return -1 if I change the line to say DateItem.Month = 2 Any ideas? This is relatively urgent. |
|
Aaron
Senior Member Joined: 29 January 2008 Status: Offline Points: 2192 |
Post Options
Thanks(0)
|
Hi,
Try this:
Set also the day to a value and you will see that all date values (day, month, year) will return the proper values.
Dim DateItem As PropertyGridItemDate
Set DateItem = Category.AddChildItem(PropertyItemDate, "Due Date", "12/30/2000") DateItem.Format = "%m%d%Y" Debug.Print Month(CDate("2 / 2 / 2008")) DateItem.Month = Month(CDate("2 / 2 / 2008")) add:
Debug.print DateItem.Month '' return -1 DateItem.Day = Day(CDate("2 / 2 / 2008"))
DateItem.Month = Month(CDate("2 / 2 / 2008")) Debug.print DateItem.Day '' return "2" Debug.print DateItem.Month '' return "2"
I noticed that if the day value (DateItem.Day) is not used again, the value for DateItem.Month will be -1.
And it doesn't matter if you use format mm/dd/yyyy or dd//mm/yyyy
It looks like a bug to me... Maybe someone from the support team can give you an explanation with this.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
You are right. If I set the Month first, it doesn't work. If I set the Day first it does. Definitely sounds like a bug.
Thanks for the help! |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |