A judgement call

.net , vb6 United States
  • 18 years ago

    What is considered the best way to check to see if a routine (subroutine, function whatever) has been called before (check to see if the current call is the first time)?


    Of course there are many ways to do this...


    Can add a global variable, set it to something like -1 and in the routine check on that value and then immediately set it to something other than -1. If it's -1 coming in it's the first time. Problem here is you need to add a global (or form level) variable.


    Can add a static variable and check for initial value (0 usually). Problem here is you are relying on VB setting initial values to be what you expect. Look at .NET everything changes!


    Is there a better way?

  • 18 years ago

    i`d stick with the global way..


    (cos i can`t think of any others)  :-)


Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The difference between theory and practice is smaller in theory than in practice.”