Results 1 to 4 of 4

Thread: Timing Internet Connection

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    65

    Post

    Ok on an app I am workin on at the moment I have it detecting whether the user is connected to the internet or not but if it finds the connection I want it to start timing the time spent online to a label
    also I want it to detect if someone is dialing up and then start timing from there.


    If anyone can help I would muchly appreciate it.

    thanx

  2. #2
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    you could time it by using the existing date and time and the one set at dial-up then subtract the current from the old you'll probably have a lot of IF's but it'ld work
    just use Left$ Mid$ and Right$ to get each section hour min sec etc.
    Hope this helps!

    ------------------
    DiGiTaIErRoR

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Posts
    65

    Post

    Can U Give Me An Example Code?

  4. #4
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    Code:
    Private Sub Form_Load()
    Label1.Caption = Time$
    label2.Caption = Time$
    End Sub
    Private Sub Timer1_Timer()
    label2.Caption = Time$
    End Sub
    Private Sub label2_Change()
    Dim Secs As Integer
    Dim Mins As Integer
    Dim Hours As Integer
        Secs = Right(label2.Caption, 2) - Right(Label1.Caption, 2)
            If Secs < 0 Then Secs = 60 - Right(Label1.Caption, 2) + Right(label2.Caption, 2)
    If Right(label2.Caption, 2) >= Right(Label1.Caption, 2) Then Mins = Val(Mid$(label2.Caption, 4, 2)) - Val(Mid$(Label1.Caption, 4, 2))
            If Mins < 0 Then Mins = 60 - Val(Mid$(Label1.Caption, 4, 2)) + Val(Mid$(label2.Caption, 4, 2))
        Hours = Left(label2.Caption, 2) - Left(Label1.Caption, 2)
            
    Text1.Text = Hours & ":" & Mins & ":" & Secs
    Secs = "0"
    End Sub
    This pretty much does it you'll need 2 labels 1 timer 1 textbox

    [This message has been edited by DiGiTaIErRoR (edited 12-03-1999).]

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