Unstructured to Structured Flow Control

    The VBUC includes features to remove unstructured “spaghetti” code and replace it with structured flow control statements in .NET. Unused labels are removed from the target .NET code.  Some of the main patterns are described in this section.

    GoTo Removal

    Goto to Do-While Statements

    Some Goto statements are used to loop a code block.  The VBUC recognizes and converts those cases that can be transformed into a structured iteration block, as shown in the following example:

    [VB6]

    myLabel:
    stmt-1
    ...
    <optional break statement>
    ...
    stmt-n
    Goto myLabel

    [C#]

    do
    {
    stmt1;
    ...
    <optional break statement>
    ...
    stm2;
    }
    while (true);

    Goto to If Statement

    Several combinations of If statements containing Gotos are supported by improving the If pattern.  The code blocks involved are included into the true/false blocks of the original If.

    A very simple example is as follows:

    [VB6]

    If Cond Then Goto myLabel
    <CodeBlock1>
    myLabel:
    <CodeBlock2>

    [C#]

    If Not Cond Then
    <CodeBlock1>
    End If
    <CodeBlock2> 

    Download VBUC Free Trial
    Download VBUC Now

    It's time to eradicate VB6
    ROI of eradicating VB6

    8 Proven Tips for
    Planning a Successful Migration

    8 Tips for migration