Results 1 to 14 of 14

Thread: Form Loading

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    558

    Form Loading

    Hey guys. I've got an incredibly complicated form. It's way too big with way too many controls so I freely admit that right off the bat.

    The program has a sign-in screen, then a splash screen and finally the main screen.

    I've got a customer with 6 brand new machines - all identical - fresh out of the box.

    The program loads just fine on 5 of the 6.

    On the 6th machine, the sign-in shows the splash screen then it does a frmMain.show and goes into hyperspace for about 1 minute. It emerges from it's slumber and works just like nothing happened. And as I said, on the other 5 no issue.

    I put in some trace code:

    MsgBox "I'm about to load the main form"

    frmMain.show

    Then in the frmMain Load event I put in code

    MsgBox "I'm loaded".

    On 5 of the 6 machines there is zero lag between the messages. On the 6th machine it's a 90 second lag.

    I'm inclined to blame the machine but all the diagnostics check out. Memory OK, Storage OK, display OK, OS is identical across all the machines. I disabled the antivirus (Defender) just for testing. Other applications load normally (Word, Excel). Just my program lags out.

    Any idea how to proceed? (Other than toss the bad machine in the dumpster).

  2. #2
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Form Loading

    I hate stuff running in the background without my permission.
    MS believes they don't need my permission.
    Windows Defender is a prime example of it.
    Even if you find out how to turn it off (temp disable), it can turn itself back on without telling you.
    I install Avast free, for 2 reasons -
    1) it Disables (replaces) Windows Defender completely
    2) you can right click Avast icon and disable until Windows reboots

    I also don't like indexing running in the background, so I completely disable that.

  3. #3
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Form Loading

    Does your program attempt any network connections (either local LAN or external access) at startup? Is the CPU getting hammered by your program during that minute of lag?

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Form Loading

    Quote Originally Posted by Bobbles View Post
    I hate stuff running in the background without my permission.
    MS believes they don't need my permission.
    Windows Defender is a prime example of it.
    Even if you find out how to turn it off (temp disable), it can turn itself back on without telling you.
    I install Avast free, for 2 reasons -
    1) it Disables (replaces) Windows Defender completely
    2) you can right click Avast icon and disable until Windows reboots

    I also don't like indexing running in the background, so I completely disable that.
    I've ran into more issues with avast than any virus software I have used, some where show stoppers, will never install it on anything again.

  5. #5
    Frenzied Member
    Join Date
    Dec 2008
    Location
    Melbourne Australia
    Posts
    1,487

    Re: Form Loading

    Quote Originally Posted by DataMiser View Post
    I've ran into more issues with avast than any virus software I have used, some where show stoppers, will never install it on anything again.
    I wonder if you were using the Pro version ?
    Which I avoid for 2 reasons -
    1) I am a Scottish pensioner
    2) The Pro version has a lot of extra stuff/crap that I do not want.
    I have been using Avast (FREE) for years in XP, 7, 8.1, 10 with no problems

    But getting back to the OP's problem, he could choose any other antivirus of his choosing, provided it too, has the ability to be manually disabled when needed.

  6. #6
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: Form Loading

    I think I would try re-installing the app and see if you get better results the second time around.
    You said everything checked out ok but does that machine have as much ram as the others? Have you checked to see if the drive needs defraged?

    As for the virus scanner I have worked with both the free version and the pro version. Both gave issues. Never had an issue with defender that I know of.
    Last edited by DataMiser; Oct 8th, 2020 at 08:41 AM.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    558

    Re: Form Loading

    Hey guys. I think I got you heading down the rabbit hole by mentioning antivirus. I disabled it just to rule out issues. Not antivirus related.

    The program was running locally so no network issues either.

    I uninstalled and reinstalled the program - it installs clean. And by the way, once it finally opens up it runs totally normally.

  8. #8
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Form Loading

    But the problem still exists, right?

    If so, try to create a small test case that reproduces the problem. Then we'll have more to go on if you post its source.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2005
    Posts
    558

    Re: Form Loading

    Quote Originally Posted by dilettante View Post
    But the problem still exists, right?

    If so, try to create a small test case that reproduces the problem. Then we'll have more to go on if you post its source.
    Small programs load just fine. This is a GIGANTIC program. Over 250,000 lines of code and tons of controls. So ya... that's not going to happen. Plus it works on virtually every computer I've put it on... so... over 1200 computers. It would probably run just fine on yours. It even runs on 5 of 6 computers for this customer. I'm going to just have to tell the customer to toss his computer in the dumpster and buy a different one.

    But thanks guys for the help!

  10. #10
    PowerPoster
    Join Date
    Feb 2017
    Posts
    4,995

    Re: Form Loading

    It is a difficult issue, if you have access to perform tests on that computer it is one situation, but if you can't, you only can guess (the cause).

    My guess is that some control that is on the form is causeing the delay, because of an antivirus or some network setting.
    Which control and what it is doing... difficult to determine without doing tests on the computer.

  11. #11
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Form Loading


  12. #12
    New Member topgearseo's Avatar
    Join Date
    Oct 2020
    Location
    India
    Posts
    2

    Re: Form Loading

    Does you have nay knowledge about this.

  13. #13
    Hyperactive Member
    Join Date
    Aug 2011
    Location
    Palm Coast, FL
    Posts
    416

    Re: Form Loading

    I tend to put longer running startup stuff in Form_Activate. This causes the form to show immediately while the code in Form_Activate executes. it doesn't actually speed up anything but the perceived speed is much faster.

    If you go this route make sure to use a module level boolean to keep track of the fact that you've already run the Form_Activate code - you don't want that code running every time the form is activated.

    Code:
    Private Sub Form_Activate
        If mbolActivationCodeAlreadyRun then Exit Sub
    
        'put your code here
        mbolActivationCodeAlreadyRun  = True
    End Sub

  14. #14
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Form Loading

    Just insert a Show (and if necessary a DoEvents() call) into the point in your Load event handler where you want the Form to show.

    No need to screw around mispurposing the Activate event.

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