Results 1 to 5 of 5

Thread: [VB6] Last Seen Feature

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Lightbulb [VB6] Last Seen Feature

    Hello
    Code:
    Private Sub Timer1_Timer() 
      ' This will save last seen for your user
      ' Dim x, y in General
      ' Timer1.Interval = 777
      x = Format$(Now, "Short Time")
      y = Format$(Now. "Short Date")
      Open "C:\MyLastSeen.dat" For Output As 1
      Write #1, x, y
      Close
    End Sub
    Private Sub Timer2_Timer() 
       ' This will load someone's last seen
       ' Dim xx, yy, zz in General
       ' Timer2.Interval = 777
       On Error Resume Next
       Open "c:\User1.dat" For Input As 1
       Input #1, xx, yy
       Close
       zz = DateDiff ("d", yy, Date)
       if zz = 0 Then
         Label1.Caption = "Last Seen Today at " & xx
       ElseIf zz = 1 Then
         Label1.Caption = "Last Seen Yesterday at " & xx
       ElseIf zz > 1 Then
         Label1.Caption = "Last Seen at " & xx & " on Date " & yy
       End if
    End Sub
    Last edited by Eng27; Feb 19th, 2019 at 10:38 AM. Reason: Added CODE tags

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: [VB6] Last Seen Feature

    Hmm, trying to provide constructive criticism.

    Do you really need to read and write the files every second? A project where its only purpose is to open/read simple files doesn't seem like it's worthy of a 4-year coder?

    As far as the code itself: What if the user has no write permissions to the root drive? Is that best place to write such a file? Not really sure of the purpose of the code. You are writing to one file, but reading another different file. Maybe an explanation is needed?

    Tip: Surround your code in [code] tags for better viewing within these forums.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,102

    Re: [VB6] Last Seen Feature

    Welcome to the forum. I edited your post to add [CODE][/CODE] tags, which you can do by pressing the # button and pasting code between the resulting tags. In this case, it really didn't add much to the formatting, so I added some spaces to get the indenting a bit better. Normally, that isn't necessary, but sometimes it is.

    As to whether or not it's in the right forum, I think it is not in the BEST forum. It IS a snippet, which would be right in the CodeBank, but you are asking for feedback, which makes it more of a question, so you'll get better answers in the Classic VB forum, and therefore I have moved it there.
    My usual boring signature: Nothing

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [VB6] Last Seen Feature

    Quote Originally Posted by Shaggy Hiker View Post
    Welcome to the forum. I edited your post to add [CODE][/CODE] tags, which you can do by pressing the # button and pasting code between the resulting tags. In this case, it really didn't add much to the formatting, so I added some spaces to get the indenting a bit better. Normally, that isn't necessary, but sometimes it is.

    As to whether or not it's in the right forum, I think it is not in the BEST forum. It IS a snippet, which would be right in the CodeBank, but you are asking for feedback, which makes it more of a question, so you'll get better answers in the Classic VB forum, and therefore I have moved it there.
    thanks a lot, this is very helpful, and thanks for the moving....

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2018
    Posts
    23

    Re: [VB6] Last Seen Feature

    Quote Originally Posted by LaVolpe View Post
    Hmm, trying to provide constructive criticism.

    Do you really need to read and write the files every second? A project where its only purpose is to open/read simple files doesn't seem like it's worthy of a 4-year coder?

    As far as the code itself: What if the user has no write permissions to the root drive? Is that best place to write such a file? Not really sure of the purpose of the code. You are writing to one file, but reading another different file. Maybe an explanation is needed?

    Tip: Surround your code in [code] tags for better viewing within these forums.

    You are right, actually I am not professional enough as the fourth year on learning, cause of no courses are teachers I had gotten.
    but, in the other hand, I am good enough to deal with simple things in the vb, like files in this thread
    look, this thread does not show the idea to be used is a classic code, this thread only shows the idea of the code, then you can use it in DataBase or module or other part of the program which would be more vital then files and Opening it...
    the other thing, I told you, I am not professional, so I need someone who had learnt vb professionally and gives me the right way to deal with codes and programming. like this code, I don't know if it good or not, if its idea good or not, if it should be posted or not! or deleted after posted. after I created this code, I used it, and got results. but I typed in the thread, I want feedbacks and remarks about it, and you gave me.. thanks a lot, and I am looking another tips from you.
    thanks for time of reading the reply.

Tags for this Thread

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