|
-
Feb 2nd, 2018, 04:02 AM
#1
Thread Starter
Junior Member
[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
-
Feb 2nd, 2018, 07:06 PM
#2
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.
-
Feb 2nd, 2018, 10:08 PM
#3
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
 
-
Feb 3rd, 2018, 01:56 AM
#4
Thread Starter
Junior Member
Re: [VB6] Last Seen Feature
 Originally Posted by Shaggy Hiker
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....
-
Feb 3rd, 2018, 02:11 AM
#5
Thread Starter
Junior Member
Re: [VB6] Last Seen Feature
 Originally Posted by LaVolpe
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|