Too many case conditions?

S

Showjumper

I am working on a CF 2.0 PPC app that utilizes a treview control. Depeding
on what node is clicked, a user control is loaded and displayed. I am
loading the user control using a select case. So far there about 10 cases.
Is that too many? Is there such a thing as too many cases?

Thanks
Ashok
 
S

Scott M.

The more cases, the greater the possibility of a slower response time for
this case statement, but is there an actual limit to the amount of cases you
can have? Not, that I'm aware of. 10 is certainly not too many.
 
M

m.posseth

Note that you should set the case that is believed to take place the most
as the first case
also a good aproach might be to use at a certain point nested cases when a
situation takes place after another should have been taken place

by the way a select case is almost always faster as nested if then else
statements if you use the above described aproach it is always the fastest
aproach :)


regards

Michel Posseth [MCP]
 
C

Carlos J. Quintero [VB MVP]

Hi Ashok,

No, 10 cases are not too many, and as long as they don´t contain expressions
that must be evaluated they are quite fast.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio 2005, Visual Studio .NET,
VB6, VB5 and VBA
You can code, design and document much faster in VB.NET, C#, C++ or VJ#
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top