Syntax issues

Avoid the GoTo statement Jumping into a branch of a compound statement is legal in PowerBuilder, because the concept of scope inside a function does not exist in PowerScript. For example, the following code works well in PowerBuilder:

if b = 0 then
    label: …
else
end if
goto label

This PowerScript translates conceptually into the following C# code:

if (b == 0)
{	// opening a new scope
    label: …
}
else
{
}
goto label; 

Since a GoTo statement is not allowed to jump to a label within a different scope in .NET, the C# code would not compile. For this reason, avoid using GoTo statements.

Do not call an indirect ancestor event in an override event Suppose that there are three classes, W1, W2, and W3. W1 inherits from Window, W2 inherits from W1, and W3 inherits from W2. Each of these classes handles the clicked event. In the Clicked event of W3, it is legal to code the following in PowerScript:

call w1::clicked

However, in C#, calling the base method of an indirect base class from an override method is not allowed. The previous statement translates into the following C# code, which might produce different behavior:

base.clicked();

In this example, a possible workaround is to move code from the Clicked event of the indirect ancestor window to a window function, and then call the function, rather than the original Clicked event, from the descendant window.