Results 1 to 21 of 21

Thread: Show WeekNumber in a DateTimePicker

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2012
    Posts
    7

    Show WeekNumber in a DateTimePicker

    Hi guys,

    good day. I have one doubt. is it possible to mark weekend days (eg: sunday) in different color and shows the week number in a drop-down calendar in the datetime picker in vb6. I search in web, but not get any useful information. anyone have idea, please give to me.thanks.

  2. #2
    Frenzied Member Gruff's Avatar
    Join Date
    Jan 2014
    Location
    Scappoose Oregon USA
    Posts
    1,293

    Re: Show WeekNumber in a DateTimePicker

    I'd say no.
    The datetimepicker control is pretty limited.
    You would either have to create your own custom control from scratch
    or purchase a third party control with that behavior if one exists.
    Burn the land and boil the sea
    You can't take the sky from me


    ~T

  3. #3
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,389

    Re: Show WeekNumber in a DateTimePicker

    Have you tried the DTPicker control in my CommonControls thread?

    In this you can display the week numbers in the drop-down and even show the dates in bold (for example all sundays).
    But the bold feature needs minimum Windows Vista, 7+.
    But the week number feature is also working on XP.

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2012
    Posts
    7

    Re: Show WeekNumber in a DateTimePicker

    Hi,

    Thanks for your reply. I download the common controls and it's useful for me.

  5. #5
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    I know this is an old thread but I hope my question isn't out of line here.
    I just downloaded your VBCCR control and I'm very impressed so far.

    I'm trying to use the date/time picker control, but something's weird. By default it appears to work. When I switch the property
    CalendarShowWeekNumbers to True, however, clicking on the picker doesn't open the calendar view at all. Am I doing something wrong?
    My apologies if there's some doc somewhere that I missed.

    Thanks, Stephan

  6. #6
    Hyperactive Member
    Join Date
    Feb 2014
    Posts
    282

    Re: Show WeekNumber in a DateTimePicker

    I tested both the OCX and non-OCX version of VBCCR15 and the calendar opened as it should. Did you by any chance accidentally set the UpDown property to True? This will show a UpDown button and the calendar will not open.

  7. #7
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Many thanks for looking into this!

    No, I didn't set the up/down property to true. I checked it, and I can see that this would not open the calendar indeed.
    When I click the down arrow on the date picker, it loses focus on the mouse-down and nothing else happens.
    BTW, I'm using VB5 here, but I wouldn't think that this would have anything to do with it.

    Setting the property 'CalendarShowWeekNumbers' to FALSE makes it work just fine, but setting it to TRUE makes it fail again. So weird.

  8. #8
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    BTW, just tried it also in VB6, same problem...

  9. #9
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,389

    Re: Show WeekNumber in a DateTimePicker

    Do you use theming ? (Manifest)
    Which OS ?

  10. #10
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Windows 7, SP1.
    I tried in the IDE and compiled, but not themed yet. Will do that next.

  11. #11
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Ahhh, I think I got it - they need to be compiled AND themed, right? In the IDE the controls look totally different! Sorry if I missed that, it wasn't obvious to me.

  12. #12
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,389

    Re: Show WeekNumber in a DateTimePicker

    Quote Originally Posted by StephanK View Post
    Ahhh, I think I got it - they need to be compiled AND themed, right? In the IDE the controls look totally different! Sorry if I missed that, it wasn't obvious to me.
    I'm just troubleshooting.
    It should though work without theming. Or it's really not supported on comctl 5.8x.
    Need to test it.

  13. #13
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Many thanks, Krool. A great project, and breathes some new life in the dated VB GUI. If there's anything you want me to check or try please let me know.
    Also, documentation of all the features is hard to find. Do you have a recommended doc? I'd work through my GUI and spiff it up if I'd know what cool new features are possible.
    Thanks again, great work!

  14. #14
    PowerPoster
    Join Date
    Jun 2012
    Posts
    2,389

    Re: Show WeekNumber in a DateTimePicker

    StephanK, I just fixed the bug. Please re-download the OCX and try again

  15. #15
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Oh, that's fast! I suppose I get it from GITHub - let me look.

  16. #16
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Ah, I see you updated your original download link - I just got it.

  17. #17
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Yay it works now. In the IDE, and complied, and also compiled with the manifest. All looks great! Many thanks.
    Any tip about what documentation to read?

  18. #18
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Show WeekNumber in a DateTimePicker

    You can do this using the MSCOMCT2.OCX DTPicker with a little finagling:

    Name:  sshot.png
Views: 1807
Size:  4.9 KB

    Code:
    Option Explicit
    
    Private Sub DTPicker1_DropDown()
        DTPStylesEx DTPicker1, WeekNumbers:=True, NoTodayCircle:=True, NoToday:=True
    End Sub
    
    Private Sub DTPicker2_DropDown()
        DTPStylesEx DTPicker2, WeekNumbers:=True
    End Sub
    
    Private Sub Form_Load()
        'The default colors used by the creaky VB6 MSCOMCT2.OCX do not work well any more.  Choose
        'some safe colors that give decent visibility:
        With DTPicker1
            .CalendarTitleBackColor = vbHighlight
            .CalendarTitleForeColor = vbHighlightText
        End With
        With DTPicker2
            .CalendarTitleBackColor = vbHighlight
            .CalendarTitleForeColor = vbHighlightText
        End With
    End Sub
    However I agree that it is better to use the CC6-capable Win32 DTPicker when possible.
    Attached Files Attached Files

  19. #19
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Ah, you mean to say that one doesn't need the whole new OCX, but can use the old one and pass some extra parameters in that DTPStylesEx function? I'll check it out also!

  20. #20
    New Member
    Join Date
    May 2018
    Posts
    12

    Re: Show WeekNumber in a DateTimePicker

    Very good, thanks! I see that even the old controls can be significantly enhanced. I appreciate all the new stuff you guys show me here.

  21. #21
    Fanatic Member
    Join Date
    Aug 2016
    Posts
    678

    Re: Show WeekNumber in a DateTimePicker

    Quote Originally Posted by dilettante View Post
    You can do this using the MSCOMCT2.OCX DTPicker with a little finagling:

    Name:  sshot.png
Views: 1807
Size:  4.9 KB

    Code:
    Option Explicit
    
    Private Sub DTPicker1_DropDown()
        DTPStylesEx DTPicker1, WeekNumbers:=True, NoTodayCircle:=True, NoToday:=True
    End Sub
    
    Private Sub DTPicker2_DropDown()
        DTPStylesEx DTPicker2, WeekNumbers:=True
    End Sub
    
    Private Sub Form_Load()
        'The default colors used by the creaky VB6 MSCOMCT2.OCX do not work well any more.  Choose
        'some safe colors that give decent visibility:
        With DTPicker1
            .CalendarTitleBackColor = vbHighlight
            .CalendarTitleForeColor = vbHighlightText
        End With
        With DTPicker2
            .CalendarTitleBackColor = vbHighlight
            .CalendarTitleForeColor = vbHighlightText
        End With
    End Sub
    However I agree that it is better to use the CC6-capable Win32 DTPicker when possible.
    You always have a lot of simple ways to solve problems.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width