Maximum size limit for Vb procedure

fathimasulthan
fathimasulthan used Ask the Experts™
on
Hi all,

 Is ther any maximum size limit for a normal Visual Basic procedure? If so how much.. If u know any URL which clearly says this detail.. Kindly let me know that link.

I highly appreciate ur help.

Thanks in advance

Fathima
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Hello fathimasulthan

What version are you using?  Here is a link that is for VB3/4.
http://support.microsoft.com/default.aspx?scid=kb;en-us;129897

Hope this helps...

Commented:
A single project can contain up to 32,000 "identifiers" (any nonreserved keyword), which include, but are not limited to, forms, controls, modules, variables, constants, procedures, functions, and objects. Note that the actual number of identifiers is limited to available memory.

Variable names in Visual Basic can be no longer than 255 characters, and the names of forms, controls, modules, and classes cannot be longer than 40 characters. Visual Basic imposes no limit on the actual number of distinct objects in a project.

The amount of code that can be loaded into a form, class, or standard module is limited to 65,534 lines. A single line of code can consist of up to 1023 bytes. Up to 256 blank spaces can precede the actual text on a single line, and no more than twenty-five line-continuation characters ( _) can be included in a single logical line.

There is no limit on the number of procedures per module. Each procedure can contain up to 64K of code. If a procedure or module exceeds this limit, Visual Basic generates a compile-time error. If you encounter this error, you can avoid it by breaking extremely large procedures into several smaller procedures, or by moving module-level declarations into another module.

Visual Basic uses tables to store the names of identifiers (variables, procedures, constants, and so on) in your code. Each table is limited to 64K.

Commented:
Sorry, forgot to mention that the specifications I mentioned are for VB6 and VB5
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
...
A single line of code can consist of up to 1023 bytes. Up to 256 blank spaces can precede the actual text on a single line, and no more than twenty-five line-continuation characters ( _) can be included in a single logical line.
...

Thats the only limit i hit once ;) (AddNew function of a HUGE DCOM class)
Commented:
Ouch! Oh, and fathimasulthan, it comes straight from the MSDN library, from a few different URLs so I could dig them out if you need an exact reference for a paper or something, otherwise, you may as well use "my" definition.
The size of compiled procedure is 64K at max.

Commented:
I would recommend that you break your procedure up into much smaller pieces.  Maintaining something that size is likely to be very difficult.  It is a general rule that each procedure / object should perform a single task.  The more that you can break things down, the easier it is likely to be to maintain and the more portable your code.
Scary question
Indeed a scary question. I'd love to know why you need to know this.

Commented:
I agree with the above posters...

If i cant fit my procedures on 2 screens max, i tent to chop them up...

Author

Commented:
moogman,Sirnick,davegaurav999

 Thanks for Ur response. This is what i expected.   Thanks for u all.  As moogman's answer is more defintive i would like to give my point to him answer.

 DominicCronin ,
    I just wanted to know becos,One of my friend attended interview and he was asked this question.

Thanks to everyone

Fathima

Commented:
If I asked that question at an interview, the answer that I would be looking for is that it's irrelevant and that no procedure ever should come anywhere near that size!  It's quite a good question!
Indeed - a gorgeous interview question. One where the correct answer is "I don't know!!"

Actually I once got a job after a long highly technical interview. The guy who interviewed me told me afterwards that if I hadn't admitted to not knowing several things, he wouldn't have offered me the job.

After being called to run the technical post-mortem after the Challenger disaster, the nobel laureate Richard Feynman famously stated: "For a successful technology,
reality must take precedence over public relations,
for nature cannot be fooled."

Technical people *must* know how to act when they don't know something. Pretending you know is almost always the incorrect course.

Author

Commented:
THANKS FOR UR HELP
Fathima

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial