Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Feb 2003
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Date/Time stamp (vb6)

    How do I freeze the date and time that an event occurs - and keep this data after closing the app?

    In VB6.0 I have a Form1 with 2 Textboxes: Text1 and Text2. plus a Label1. In the Form_Load event I have the following code:

    'check the flag
    If Label1.Caption <> "1" Then
    Text1.Text = Date
    Text2.Text = Time

    'set the flag
    Label1.Caption = "1"
    End if

    This sets the Date/time the first time the form loads. The flag prevents it from resetting on subsequent loads. However, when I close the app and re-open a new Date/Time is set. How can I keep the original value after closing?

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Date/Time stamp (vb6)

    You will need to save the date and time somewhere.

    It can be the Registry, an INI file, a text file, a database.....

    There is no way to actually save date and time in your VB application.

    To read and write to the registry, look up SaveSetting, GetSetting, GetAllSettings and DeleteSetting in the help file.
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

Posting Permissions

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