VB 6 -Skipping lines of code...
Ok so I've been working on this program for quite awhile and recently i've received this error saying "Procedure Is To Long" or something along those lines.. anyway i fixed that by creating a function and then calling that function from the procedure therefore splitting the code into two.. well now, the program runs gets to the function runs through a bit of the code and then skips the rest and goes back to the procedure that called it.
I've checked and double checked to make sure i didn't overlook an "Exit Sub" or something that would tell the program to skip the lines that it is, my only guess is that splitting the code into two chunks and calling the second chunk through a function will apparently not fix the "Procedure is to long" problem. Has anyone ever run into this before? Any guidence would be great. ;) |
Re: VB 6 -Skipping lines of code...
What's the error number?
Never heard of something like this, but it sounds like really really bad code (welcome spaghetti). Well, splitting the code into multiple parts would exactly be the way to solve this problem. And it should work without skipping code. You must've done something wrong. Code? |
Re: VB 6 -Skipping lines of code...
There's no error it simply stops in the middle of a function and goes back to the procedure that called it without completing the rest of the code.
form load -calls cmdSearch cmdSearch -Executes quite a few lines of code -then executes a call ShiftDisplay function ShiftDisplay -executes quite a few lines of code but half way through goes back to cmdSearch at the End Sub line Code: After this line of code it goes back to the cmdSearch procedure: Code:
adoShifts.Recordset.MoveFirst It is then followed by multiple ElseIf statments, which i know its suppose to skip. The code that follows the If statement isn't executed. |
Re: VB 6 -Skipping lines of code...
Just out of curiosity:
Quote:
Concerning your problem: Well. It still doesn't sound really believable. Did you use Debug.Print or MsgBox to "prove" where the program "jumps out"? Did you compile an exe and see if the same happens? I strongly suggest to try "step by step" mode using F8. See what happens then. No other idea right now, sorry... (VB6 SP6 is installed?) |
Re: VB 6 -Skipping lines of code...
Don't you all just love VB6 ?
What happens if you compile it to machinecode BTW? Does it run fine then? It seems more of a problem with the interpreter than with the code. I'd define a custom errorhandler for the second function and see if there's no error generated in there (I assume you inherit the first functions errorhandler ATM?). |
Re: VB 6 -Skipping lines of code...
Thats not the exact wording of the error but thats what its meaning was.. i'll try to get the error again and let you know the specifics...
Ok, it says: Quote:
Quote:
Quote:
I took the code out of the function and placed it back in the cmdSearch procedure, I then shortened some of the code in the procedure and it no longer skips the code... so it seems to be something to do with calling a function... idk as long as i can manage the size of the procedure i guess i'll be alright. btw thanks for the help. |
Re: VB 6 -Skipping lines of code...
Quote:
|
Re: VB 6 -Skipping lines of code...
Did you call End Sub instead of End Function?
(It might have to be Exit Sub instead of Exit Function - I'm not hot on VB syntax.) |
Re: VB 6 -Skipping lines of code...
Quote:
|
Re: VB 6 -Skipping lines of code...
Quote:
|
Re: VB 6 -Skipping lines of code...
thanks for the lookup Caesar2. I figured that would fix it which it did... but now its confusing me to why its skipping lines of code, which i've bypassed by shortening the orignal procedure and keeping everything together... we'll see if i can get by with keeping the procedure within 64kb..
|
Re: VB 6 -Skipping lines of code...
Quote:
"Hey... let's statically allocate memory for procedures... 64k should do it." I get the shivers when I see stuff like that. It once took me two days to hunt down a bug that crashed the IDE because someone decided it'd be cool to have a statically allocated array filled by a function in a DLL, and then go over the bounds. Particularly cool when you don't have the code of the DLL, and don't even have an idea what the fk it does. Well, atleast these guys were nice enough to generate an error instead of just letting it crash and burn. |
Re: VB 6 -Skipping lines of code...
for some strange reason known only to himeself, my college admin has decided to block all microsoft websites. even msdn :(
|
Re: VB 6 -Skipping lines of code...
Sounds like a sensible sysadmin tbh.. ;)
|
Re: VB 6 -Skipping lines of code...
This begs the question, why do you have (or need) a single procedure thats 64k in length?
|
Re: VB 6 -Skipping lines of code...
Because he needs some lines of code to executed a couple of hundred times?
[/badjoke] :-/ |
All times are GMT +1. The time now is 11:46. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018