Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Oct 2001
    Thanked 0 Times in 0 Posts

    calendar control 10.0 (2002 sp1)

    How can I get the calendar control object to update to the system date automatically? I have been unable to find anything online. thank you. sb

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: calendar control 10.0 (2002 sp1)

    The calendar control doesn't update automatically. You can take care of it with one line of code, however. Put the following instruction in the OnLoad event procedure of the form containing the calendar control:

    [calCalendar] = Date

    where calCalendar is the name of the calendar control. If you don't know what is meant by "OnLoad event procedure", post back.

  3. #3
    Silver Lounger
    Join Date
    Jan 2001
    Indianapolis, Indiana, USA
    Thanked 0 Times in 0 Posts

    Re: calendar control 10.0 (2002 sp1)

    I found this API example included with the free API-Guide (3.7) from<pre>Private Type SYSTEMTIME
    wYear As Integer
    wMonth As Integer
    wDayOfWeek As Integer
    wDay As Integer
    wHour As Integer
    wMinute As Integer
    wSecond As Integer
    wMilliseconds As Integer
    End Type
    Private Declare Function SetSystemTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) As Long
    Private Sub Form_Load()
    'KPD-Team 2000
    Dim lpSystemTime As SYSTEMTIME
    lpSystemTime.wYear = 2000
    lpSystemTime.wMonth = 1
    lpSystemTime.wDayOfWeek = -1
    lpSystemTime.wDay = 24
    lpSystemTime.wHour = 23
    lpSystemTime.wMinute = 26
    lpSystemTime.wSecond = 0
    lpSystemTime.wMilliseconds = 0
    'set the new time
    SetSystemTime lpSystemTime
    End Sub</pre>

    You'll probably want to change this into a function and call it in the Calendar Control's On_Change event. Post back if you need a hand with this.

    Edited because of misreading the original request:
    Oops - on reading the original post a second time, I see that you asked how to have the Calendar control show the system date - not how to set the system date. Sorry for the confusion. But for the record, this code will allow you to set the system date. (It's time to replace my contact lenses) <img src=/S/gent.gif border=0 alt=gent width=17 height=25>

Posting Permissions

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