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
  1. Home
  2. General Programming
  3. C#
  4. How to calculate form loading time

How to calculate form loading time

Scheduled Pinned Locked Moved C#
tutorial
11 Posts 5 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.
  • S Offline
    S Offline
    sindhutiwari
    wrote on last edited by
    #1

    Hi I have created a splash screen on my own i want my original screen to be appear completely before the splash screen vanishes ....please if any one knows how to calculate the loading time of the form then please do let me know this is my code for the splash screen >>> Timer is calling this function .....so its the starting form of mine private void check(object sender, EventArgs e) { if (i < 1 && status == true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { status = false; } } else if (status == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); printsoftwareparent psf = new printsoftwareparent(); psf.Show(); } }

    its me sid

    G P X G 4 Replies Last reply
    0
    • S sindhutiwari

      Hi I have created a splash screen on my own i want my original screen to be appear completely before the splash screen vanishes ....please if any one knows how to calculate the loading time of the form then please do let me know this is my code for the splash screen >>> Timer is calling this function .....so its the starting form of mine private void check(object sender, EventArgs e) { if (i < 1 && status == true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { status = false; } } else if (status == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); printsoftwareparent psf = new printsoftwareparent(); psf.Show(); } }

      its me sid

      G Offline
      G Offline
      Giorgi Dalakishvili
      wrote on last edited by
      #2

      I suspect you can calculate form loading time only approximately if you can at all so instead I suggest that the main form signals splash screen form when finishes initialization.

      #region signature my articles #endregion

      S 1 Reply Last reply
      0
      • G Giorgi Dalakishvili

        I suspect you can calculate form loading time only approximately if you can at all so instead I suggest that the main form signals splash screen form when finishes initialization.

        #region signature my articles #endregion

        S Offline
        S Offline
        sindhutiwari
        wrote on last edited by
        #3

        hi thanks for ur reply I want the application to be started like Acrobat Reader or PhotoShop If u know how to do this then please do let me know

        its me sid

        G 1 Reply Last reply
        0
        • S sindhutiwari

          Hi I have created a splash screen on my own i want my original screen to be appear completely before the splash screen vanishes ....please if any one knows how to calculate the loading time of the form then please do let me know this is my code for the splash screen >>> Timer is calling this function .....so its the starting form of mine private void check(object sender, EventArgs e) { if (i < 1 && status == true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { status = false; } } else if (status == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); printsoftwareparent psf = new printsoftwareparent(); psf.Show(); } }

          its me sid

          P Offline
          P Offline
          phannon86
          wrote on last edited by
          #4

          Maybe not a very good way of doing it, but how about getting DateTime.Now when your app starts, and DateTime.Now when it's finished loading, calculate the difference. Should give you a fairly accurate time.

          He who makes a beast out of himself gets rid of the pain of being a man

          G 1 Reply Last reply
          0
          • P phannon86

            Maybe not a very good way of doing it, but how about getting DateTime.Now when your app starts, and DateTime.Now when it's finished loading, calculate the difference. Should give you a fairly accurate time.

            He who makes a beast out of himself gets rid of the pain of being a man

            G Offline
            G Offline
            Giorgi Dalakishvili
            wrote on last edited by
            #5

            He is interested in knowing load time before the application has loaded.

            #region signature my articles #endregion

            1 Reply Last reply
            0
            • S sindhutiwari

              Hi I have created a splash screen on my own i want my original screen to be appear completely before the splash screen vanishes ....please if any one knows how to calculate the loading time of the form then please do let me know this is my code for the splash screen >>> Timer is calling this function .....so its the starting form of mine private void check(object sender, EventArgs e) { if (i < 1 && status == true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { status = false; } } else if (status == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); printsoftwareparent psf = new printsoftwareparent(); psf.Show(); } }

              its me sid

              X Offline
              X Offline
              Xmen Real
              wrote on last edited by
              #6

              insert a timer in your form and enable it after all code in Form Load event, like:

              private void Form1_Load(object sender, EventArgs e)
              {
              // code if any
              timer1.Enabled = true;
              }

              then in timer1_Tick event, show your splash screen. if you want to delay in showing splash screen then just increase the timer1 interval NOTE: Do not forget to disable timer, you can disable it in timer1_tick event.

              private void timer1_tick(object sender, EventArgs e)
              {
              timer1.Enabled = false;
              // splash screen code
              }

              hope it will help.

              Becoming Programmer...

              S 1 Reply Last reply
              0
              • S sindhutiwari

                hi thanks for ur reply I want the application to be started like Acrobat Reader or PhotoShop If u know how to do this then please do let me know

                its me sid

                G Offline
                G Offline
                Giorgi Dalakishvili
                wrote on last edited by
                #7

                You can start other applications using Process class but I don't think you will be able to estimate their load time.

                #region signature my articles #endregion

                1 Reply Last reply
                0
                • X Xmen Real

                  insert a timer in your form and enable it after all code in Form Load event, like:

                  private void Form1_Load(object sender, EventArgs e)
                  {
                  // code if any
                  timer1.Enabled = true;
                  }

                  then in timer1_Tick event, show your splash screen. if you want to delay in showing splash screen then just increase the timer1 interval NOTE: Do not forget to disable timer, you can disable it in timer1_tick event.

                  private void timer1_tick(object sender, EventArgs e)
                  {
                  timer1.Enabled = false;
                  // splash screen code
                  }

                  hope it will help.

                  Becoming Programmer...

                  S Offline
                  S Offline
                  sindhutiwari
                  wrote on last edited by
                  #8

                  Thanks for the suggestions ...in mean time i have done something its working satisfactory but not as i expected private void check(object sender, EventArgs e) { if (i < 1 && stat== true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { stat = false; printsoftwareparent psp = new printsoftwareparent(); psp.Show(); this.BringToFront(); } } else if (stat == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); } }

                  its me sid

                  X 1 Reply Last reply
                  0
                  • S sindhutiwari

                    Thanks for the suggestions ...in mean time i have done something its working satisfactory but not as i expected private void check(object sender, EventArgs e) { if (i < 1 && stat== true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { stat = false; printsoftwareparent psp = new printsoftwareparent(); psp.Show(); this.BringToFront(); } } else if (stat == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); } }

                    its me sid

                    X Offline
                    X Offline
                    Xmen Real
                    wrote on last edited by
                    #9

                    you have said that you want to show splash screen just like Acrobat Reader that mean the splash screen should show after the Form1. as i read your code, you are trying to show Splash screen as fading but you doing little wrong, read my previous post carefully that will help you

                    Becoming Programmer...

                    S 1 Reply Last reply
                    0
                    • X Xmen Real

                      you have said that you want to show splash screen just like Acrobat Reader that mean the splash screen should show after the Form1. as i read your code, you are trying to show Splash screen as fading but you doing little wrong, read my previous post carefully that will help you

                      Becoming Programmer...

                      S Offline
                      S Offline
                      sindhutiwari
                      wrote on last edited by
                      #10

                      I would like to clear...what i said Firstly the splash screen comes and in the background the software parent form gets loaded as the form screen disappears with in no time the parent form must appear splash screen is shown to hide the slow loading of the parent form i hope i am clear regards sindhu tiwari:rose:

                      its me sid

                      1 Reply Last reply
                      0
                      • S sindhutiwari

                        Hi I have created a splash screen on my own i want my original screen to be appear completely before the splash screen vanishes ....please if any one knows how to calculate the loading time of the form then please do let me know this is my code for the splash screen >>> Timer is calling this function .....so its the starting form of mine private void check(object sender, EventArgs e) { if (i < 1 && status == true) { this.Opacity = i; i = i + 0.1; if (i > 0.9) { status = false; } } else if (status == false) { this.Opacity = i; i = i - 0.1; } if (i < 0.1) { timer1.Stop(); this.Hide(); printsoftwareparent psf = new printsoftwareparent(); psf.Show(); } }

                        its me sid

                        G Offline
                        G Offline
                        girish123
                        wrote on last edited by
                        #11

                        TRY THIS !!!! in timer properties..set Enabled to true and interval to 1 private void SplashScreen_Load(object sender, EventArgs e) { timer.Enabled = false; this.Opacity = 0; } private void timer_Tick(object sender, EventArgs e) { if (Splash > 2) { timer.Enabled = false; this.Hide(); frmLogin Login = new frmLogin(); Login.Show(); } else { Splash += 0.01; this.Opacity = Splash; } }

                        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