Use of Sub New procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I am adding code to a class's Sub New () procedure to initialize my program.
This code has If Then statements and inside these some registryObject
GetValue calls. When I step through the lines of code one line at a time and
it comes to the statement

If CType(registryObject.GetValue("Speed"), String) = "Fast" Then,

program execution seems to bypass all remaining code in the Sub New
procedure. No error or exception though code is in a Try/Catch block. The
program's execution continues normally except for the fact that my Sub New
code didn't seem to have loaded.

Any suggestions/help is appreciated.

Regards, drumred (not dumbhead)
 
Just so you use common terminology, Sub New is the constructor (ctor).

What makes you believe that this is special? Have you tried the exact same
code in a normal method, e.g. a button click event handler?

When you say that the rest of the method is skipped it could be because your
method doesn't have anything beyond this If method. So the condition
evaluates to false and hence nothing more to execute. Put a breakpoint on
the End Sub.

After you've tried the above, if you are still having issue post a complete
repro sample.

Cheers
Daniel
 
Back
Top