Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1449

[VB6] Last Seen Feature

$
0
0
Hello Everyone
I am new here, I wish this is the correct place to post in..
I am Hasan M. al-Fahl, known as Eng27 in programming, I have been learning VB6 for 4 years, without courses, without teachers, and I am now good enough to help others..
This is my first post, as you see. and I want to talk about a feature, which shows last seen if other users (if your program is multiuser), Like one in whatsapp :)
I made it and I want some help to make it better:

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 = = 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

Viewing all articles
Browse latest Browse all 1449

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>