Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. How can I use a Timer control to test how long it takes for a form to load?????

How can I use a Timer control to test how long it takes for a form to load?????

Scheduled Pinned Locked Moved Visual Basic
question
8 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joey Picerno
    wrote on last edited by
    #1

    I want to test how long it takes to load a form with 150 buttons with a background image(on each button) and test how long it takes to open a form with 150 buttons without a background image(on each button)... I have never worked with a timer control and Im assuming that is what I will want to use. I have built three forms, the first form has two buttons, one to open each of the forms with the buttons. The next form has 150 buttons each with a background image, the last form is the same except each button does not have a background image. That is as far as I have gotten, can someone please explain to me what I need to do from here. Thank you...

    N 1 Reply Last reply
    0
    • J Joey Picerno

      I want to test how long it takes to load a form with 150 buttons with a background image(on each button) and test how long it takes to open a form with 150 buttons without a background image(on each button)... I have never worked with a timer control and Im assuming that is what I will want to use. I have built three forms, the first form has two buttons, one to open each of the forms with the buttons. The next form has 150 buttons each with a background image, the last form is the same except each button does not have a background image. That is as far as I have gotten, can someone please explain to me what I need to do from here. Thank you...

      N Offline
      N Offline
      nlarson11
      wrote on last edited by
      #2

      Since this is a test, you don't have to do it perfectly. Create a global variable called dtBuild as date Dim oFrm as form1 dtBuild = now ofrm.show In the activate event of form1 put this code MsgBox((Now.Subtract(dtBuild).TotalMilliseconds) / 1000) -- modified at 11:19 Wednesday 8th November, 2006

      J 1 Reply Last reply
      0
      • N nlarson11

        Since this is a test, you don't have to do it perfectly. Create a global variable called dtBuild as date Dim oFrm as form1 dtBuild = now ofrm.show In the activate event of form1 put this code MsgBox((Now.Subtract(dtBuild).TotalMilliseconds) / 1000) -- modified at 11:19 Wednesday 8th November, 2006

        J Offline
        J Offline
        Joey Picerno
        wrote on last edited by
        #3

        I just get a message box with a zero in it BEFORE the form loads. The msgbox comes up, i click OK and then the form loads... Any ideas????

        N 1 Reply Last reply
        0
        • J Joey Picerno

          I just get a message box with a zero in it BEFORE the form loads. The msgbox comes up, i click OK and then the form loads... Any ideas????

          N Offline
          N Offline
          nlarson11
          wrote on last edited by
          #4

          Try this instead 1) put a dummy label on your form. 2) dim a variable at the form level Private dt As Date 3) code activate with the result Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Label1.Text = (Now.Subtract(dt).TotalMilliseconds / 1000).ToString End Sub 4) code the handlecreated event with the start of the "timer" Private Sub Form2_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.HandleCreated dt = Now End Sub

          J 2 Replies Last reply
          0
          • N nlarson11

            Try this instead 1) put a dummy label on your form. 2) dim a variable at the form level Private dt As Date 3) code activate with the result Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Label1.Text = (Now.Subtract(dt).TotalMilliseconds / 1000).ToString End Sub 4) code the handlecreated event with the start of the "timer" Private Sub Form2_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.HandleCreated dt = Now End Sub

            J Offline
            J Offline
            Joey Picerno
            wrote on last edited by
            #5

            OK cool, that worked, I THINK.... Do you think its possible for a form full of buttons with a background images to load faster than a form with the same amount of buttons that do no have a background image??? because that is what I am getting...

            1 Reply Last reply
            0
            • N nlarson11

              Try this instead 1) put a dummy label on your form. 2) dim a variable at the form level Private dt As Date 3) code activate with the result Private Sub Form2_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated Label1.Text = (Now.Subtract(dt).TotalMilliseconds / 1000).ToString End Sub 4) code the handlecreated event with the start of the "timer" Private Sub Form2_HandleCreated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.HandleCreated dt = Now End Sub

              J Offline
              J Offline
              Joey Picerno
              wrote on last edited by
              #6

              actually nevermind, it doesnt work. I mean it shows how long it takes for the form and the label to load. The label appears before the buttons all are loaded. I need to to appear after the buttons are loaded...

              N 1 Reply Last reply
              0
              • J Joey Picerno

                actually nevermind, it doesnt work. I mean it shows how long it takes for the form and the label to load. The label appears before the buttons all are loaded. I need to to appear after the buttons are loaded...

                N Offline
                N Offline
                nlarson11
                wrote on last edited by
                #7

                how about moving the code from the activate to the paint event...?

                J 1 Reply Last reply
                0
                • N nlarson11

                  how about moving the code from the activate to the paint event...?

                  J Offline
                  J Offline
                  Joey Picerno
                  wrote on last edited by
                  #8

                  that worked!!! thank you very much for your help...

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups