Results 1 to 5 of 5

Thread: Having Troubles after application is compiled...

  1. #1

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Unhappy

    Hello everyone, i am making an experiment, and i need to send this to 3 other people. But when i make an .exe the program doesnt' even work correctly....for instance, here is my code:
    Code:
    Private Sub Command1_Click()
    
    
    Dim x As Single
    Dim i As Long
    
    x = Timer
    
    For i = 0 To 100000000
     i = i + 1
        
    Next i
    
    x = Timer - x
    
    MsgBox "The loop took " & x & " seconds."
    
    End Sub
    this will time a loop and display how long it took to cycle threw it...in Run time, i click it it says somtimes 6 seconds somtimes 7, and when i make an .exe it says .04984 or 1 second, whats up? is there anyway for me to fix it so it wont' do this?

    Thanks for listening



  2. #2
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52
    What did you want? Compiled code will always run a lot faster then when it is run from the IDE. Your code is probably timing correctly.

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Doesn't do what? If you want it to show only whole numbers you can format the result.
    Code:
    Number=Format(Number,"0")
    Of course this will round up so .5 and up is 1 and .4 and below is 0.

  4. #4

    Thread Starter
    Registered User struntz's Avatar
    Join Date
    Aug 1999
    Location
    Brockway,Pa,USA
    Posts
    199

    Talking Oh so what would be a reasonalbe number?

    my number is already huge....
    100000000

    How much bigger should i make it so when i run the program....on other computers, say the person has a processor that is a 700, i want it to at least break 1 when its timed, or is that reasonable for the loop to go so fast?


  5. #5
    Member
    Join Date
    May 2000
    Location
    Canada
    Posts
    52


    For i = 0 To 100000000
    i = i + 1

    Next i

    Take out the i = i + 1 part. You are actually counting by 2's. If not enough yet then either increase the number or put another loop in to slow it down.


    Dim i as long
    Dim j as long

    For i = 0 To 100000000
    for j = 1 to 100
    next j
    Next i


    this is the same as counting to 100, 100000000 times



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