If you are migrating a Powerbuilder Application to .NET the
more recommend language you can use is VB.NET. This because this language has a
lot of common elements with PowerScript. Lets see some simple comparisons.
Variable definition
A variable is defined writing the Data Type just before the name.
For example:
Integer amount
String name
In VB.NET this will
be
Dim amount as Integer
Dim name as String
Constants
constant integer MAX = 100
In VB.NET this will
be
Const MAX As Integer = 100
Control Flow: If Statement
If monto_cuota=13 Then
nombre= 'Ramiro'
ElseIf monto_cuota=15 Then
nombre= 'Roberto'
Else
nombre= 'Francisco'
End If
This code is almost exactly the same in VB.NET
If
monto_cuota = 13 Then
nombre = "Ramiro"
ElseIf
monto_cuota = 15 Then
nombre = "Roberto"
Else
nombre = "Francisco"
End If
Control Flow: Choose Statement
Choose case monto_cuota
Case Is< 13: nombre='Ramiro'
Case 16 To 48:nombre= 'Roberto'
Else
nombre='Francisco'
End Choose
This code is slightly different:
Dim
monto_cuota As Integer
Dim
nombre As String
Select Case monto_cuota
Case Is < 13
nombre = "Ramiro"
Case
16 To 48
nombre = "Roberto"
Case
Else
nombre = "Francisco"
End Select
Control Flow: For statement
For n = 5 to 25 step 5
a = a+10
Next
In VB.NET
Dim n, a As
Integer
For n = 5
To 25 Step 5
a = a + 10
Next
Control Flow: Do Until, Do While
integer
A = 1, B = 1
//Make
a beep until variable is greater than 15 variable
DO
UNTIL A > 15
Beep(A)
A = (A + 1) * B
LOOP
integer
A = 1, B = 1
//Makes
a beep while variable is less that 15
DO
WHILE A <= 15
Beep(A)
A = (A + 1) * B
LOOP
In VB.NET
Dim A As Integer = 1, B As Integer = 1
'Make a beep
until variable is greater than 15 variable
Do Until a > 15
Beep(a)
a = (a + 1) * B
Loop
'Makes a beep
while variable is less that 15
Do While A <= 15
Beep(a)
a = (a + 1) * B
Loop