Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Controls
  New Posts New Posts RSS Feed - [SOLVED] DateTimePicker Display Bug!?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[SOLVED] DateTimePicker Display Bug!?

 Post Reply Post Reply
Author
Message
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED] DateTimePicker Display Bug!?
    Posted: 25 August 2010 at 4:57am
Hi,

I am using several DateTimePicker controls on a form and my requirement initally is to have these blank so the user must enter a date. I have done this using the following code in the Form Load event:


Private Sub Form_Load()
    With dtpDateOfRequest
        .Format = xtpPickerCustom       
        .Value = Format$(Date, "dd/mm/yyyy")
        .CustomFormat = " "
    End With
End Sub

So far so good, the control is blank and all seems fine... until I try and select a date, without setting the CustomFormat to "dd/mm/yyyy" I get no date appearing in the control so using the following code I get the date to appear, however the date displays as "25/00/2010":


Private Sub dtpDateOfRequest_Change()
    Debug.Print dtpDateOfRequest.Value
    dtpDateOfRequest.CustomFormat = "dd/mm/yyyy"
    Debug.Print dtpDateOfRequest.Value
End Sub

The Debug.Print lines cleary print the date as "25/08/2010" but the control displays "25/00/2010", is this a bug or am I doing something wrong?

Thanks...


Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 25 August 2010 at 5:21am
Hi,

I have resolved my issue however I am not sure if the above mentioned is a bug or not as the month in CustomFormat "dd/mm/yyyy" is displaying as "00" so I will leave this open for now...

I managed to make the DateTimePicker display as blank and then display the correct date on change by using the following code:


Private Sub Form_Load()
    With dtpDateOfRequest
        .Value = Format$(Date, "dd/mm/yyyy")
        .Format = xtpPickerCustom
        .CustomFormat = " "
    End With
End Sub

Private Sub dtpDateOfRequest_CloseUp()
    dtpDateOfRequest.Format = xtpPickerShortDate
End Sub

Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
Back to Top
Hemesh View Drop Down
Senior Member
Senior Member


Joined: 10 August 2010
Status: Offline
Points: 135
Post Options Post Options   Thanks (0) Thanks(0)   Quote Hemesh Quote  Post ReplyReply Direct Link To This Post Posted: 27 August 2010 at 11:19am
maybe try dd/MM/yyyy instead of dd/mm/yyyy?
Product: Xtreme SuitePro (ActiveX) version 18.5.0

Platform: Windows 7 Enterprise (64-bit)

Language: Visual Basic 6.0
Back to Top
Xander75 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 April 2007
Status: Offline
Points: 353
Post Options Post Options   Thanks (0) Thanks(0)   Quote Xander75 Quote  Post ReplyReply Direct Link To This Post Posted: 30 August 2010 at 3:24am
Hemesh,
 
Thanks for that, this has resolved the issue I was having.
Product: Xtreme SuitePro (ActiveX) v15.3.1
Platform: Windows 7 64-bit (SP1) Professional Edition
Languages: C#.Net using Visual Studio 2012 & Visual Basic 6.0 (SP6)
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.203 seconds.