Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Property Grid
  New Posts New Posts RSS Feed - Date Problem with PropertyGridItemDate
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Date Problem with PropertyGridItemDate

 Post Reply Post Reply
Author
Message
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Topic: Date Problem with PropertyGridItemDate
    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.
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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.
 
 
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post 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!


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.