Print Page | Close Window

Date Problem with PropertyGridItemDate

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=9514
Printed Date: 04 October 2024 at 2:48am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Date Problem with PropertyGridItemDate
Posted By: jcollier
Subject: Date Problem with PropertyGridItemDate
Date 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.



Replies:
Posted By: Aaron
Date Posted: 06 February 2008 at 2:13pm
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.
 
 


Posted By: jcollier
Date Posted: 06 February 2008 at 2:27pm
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!





Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net