Results 1 to 3 of 3

Thread: [RESOLVED] increasing monthview's days

  1. #1

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Resolved [RESOLVED] increasing monthview's days

    I have the current date displayed in a label. That current date is supplied by the monthview control when the program starts. Now the user of the program will want to look at previous and future days/dates. For this I have two buttons which decrease or increase the day by only one day. But the following code doesn't work. And after searching around I could only find examples where the user clicks on the monthview control and I couldn't work it out. So does anyone know how to do this? Thanks.

    Increase:
    Code:
    label.Caption = Format(calendar.Value + 1, "dddd d MMM yyyy")
    Decrease:
    Code:
    label.Caption = Format(calendar.Value - 1, "dddd d MMM yyyy")

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: increasing monthview's days

    I'm a little confused - if you have calendar type (the monthview) control on your form why do you need another control (buttons) to change its value?
    How is not enough to simply let your users select date directly on the calendar?
    Instead of monthview you can also use DateTimePicker control.

    In case you still want to use buttons you need to change calendar's value first and DateAdd() function comes handy:
    Code:
    MonthView1.Value = DateAdd("d", 1, MonthView1.Value) 'or -1
    'you may now assign caption to label control as you already do

  3. #3

    Thread Starter
    Lively Member Yumby's Avatar
    Join Date
    Feb 2009
    Posts
    120

    Re: increasing monthview's days

    Thanks RhinoBull that works well. I know what you mean about clicking on the control but I went with this way because I reckon there'll be less chance of error or mistakes when I consider the computer knowledge of the user. Nice work, thanks again.

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