-
Oct 7th, 2020, 07:05 PM
#1
Thread Starter
Fanatic Member
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).
-
Oct 7th, 2020, 10:29 PM
#2
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.
-
Oct 7th, 2020, 10:39 PM
#3
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?
-
Oct 8th, 2020, 01:03 AM
#4
Re: Form Loading
Originally Posted by Bobbles
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.
-
Oct 8th, 2020, 01:18 AM
#5
Re: Form Loading
Originally Posted by DataMiser
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.
-
Oct 8th, 2020, 08:37 AM
#6
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.
-
Oct 8th, 2020, 12:49 PM
#7
Thread Starter
Fanatic Member
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.
-
Oct 8th, 2020, 01:15 PM
#8
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.
-
Oct 8th, 2020, 04:21 PM
#9
Thread Starter
Fanatic Member
Re: Form Loading
Originally Posted by dilettante
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!
-
Oct 8th, 2020, 04:41 PM
#10
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.
-
Oct 8th, 2020, 07:46 PM
#11
-
Oct 9th, 2020, 03:11 AM
#12
New Member
Re: Form Loading
Does you have nay knowledge about this.
-
Oct 16th, 2020, 09:36 AM
#13
Hyperactive Member
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
-
Oct 16th, 2020, 10:14 AM
#14
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|