Visual Studio 2005 documentation updated for Visual FoxPro 9.0 language comparisons

The references below are the updated Visual FoxPro 9.0 language comparison items updated for the Visual Studio 2005 documentation and are new from the Visual Studio .NET 2003 documentation online in the MSDN Library document for the section called Language References. Below are the links to the pages updated which are older compared to the new followed by the updated Visual FoxPro 9.0 language references:


Keywords Compared in Different Languages

Purpose

Visual Basic

Visual J#

C++

C# NEW 

JScript

Visual FoxPro

Create a new object

New

new

new

new

new

NEWOBJECT()

 

CreateObject()

n/a

CoCreateInstance() (for COM objects)

 

new ActiveXObject()

CREATEOBJECT()

Refer to the current object

Me3

this

this

this

this

this;

thisform

Initialize a variable where it is declared

Dim x As Long = 5

Dim c As New Car(FuelTypeEnum.Gas)

int x = 5;

//or initialized by constructor

C c(10);

int x=5;

// initialize to a value:

int x = 123;

// or use default constructor:

int x = new int();

var x = 5

var y : car = new car()

LOCAL x

x = 5

Test for an object variable that does not refer to an object

obj = Nothing

pObj == null

pobj == NULL

obj == null

obj == undefined

obj == null

VARTYPE(obj)==”O”

Value of an object variable that does not refer to an object

Nothing

null

n/a

null

null

undefined

.F.

Object-Oriented Programming

Purpose

Visual Basic

Visual J#

C++

C# NEW 

JScript

Visual FoxPro

Refer to a base class

MyBase NEW 

super

__super

base

super NEW 

BaseClass property; ParentClass property; DODEFAULT();

Class::Member

Declare a class

Class NEW <implementation>

class

class

class

class NEW 

DEFINE CLASS MyClass AS <ParentClass>

Specify the events for which an event procedure will be called

Handles NEW (Event procedures can still be associated with a WithEvents variable by naming pattern.)

n/a

n/a

n/a

n/a

BINDEVENTS()

Decision Structures

Purpose

Visual Basic

Visual J#

C++

C# NEW 

JScript

Visual FoxPro

Decision structure
(selection)

Select Case ..., Case, Case Else, End Select

switch, case, break, default

switch, case, default, goto, break

switch, case, default, goto, break

switch, case, break

CASE;

ICASE()

Decision structure (if ... then)

If ... Then, ElseIf ... Then, Else, End If

if, else

if, else

if, else

if, else

IF ... ENDIF;

IIF()

Loop structure
(iteration)

For ..., [Exit For,] Next

For Each ..., [Exit For,] Next

for, break

for

for, foreach

for (x=0;x<10;x++){...}

for (prop in obj) { print (obj[prop]);}

FOR (clauses), FOR ... ENDFOR, Continue, NEXT

Arrays

Purpose

Visual Basic

Visual J#

C++

C# NEW 

JScript

Visual FoxPro

Initialize an array

Dim a() As Long = {3, 4, 5}

int[] x = {1,2,3,4,5};

int x[5]= {1,2,3,4,5};

int[] x = new int[5] {1, 2, 3, 4, 5};

var x : int[] = [1, 2, 3, 4, 5], var arr = new Array(1, 2, 3, 4, 5)]

x[1] = 1

X[2] = 2

Misc.

Purpose

Visual Basic

Visual J#

C++

C# NEW 

JScript

Visual FoxPro

Declare and raise an event

Event, RaiseEvent

Use the java.awt.Event class or /** @event */

n/a

event

n/a

RAISEEVENT()

  

Programming Concepts Compared in Different Languages with Code Examples

Conditional Statements

Visual FoxPro

IF nCnt < nMax
   nTot = nTot * nCnt
   nCnt = nCnt + 1
ELSE
   nTot = nTot * nCnt
   nCnt = nCnt - 1
ENDIF

Hiding Base Class Members

Visual FoxPro

oBase = newobject ("BaseCls")
oDerived = newobject ("DerivedCls")
 
?oBase.Z
?oDerived.Z
 
DEFINE CLASS BaseCls AS SESSION
   PROTECTED Z      && The element to be hidden outside of class
   Z = 100
ENDDEFINE
 
DEFINE CLASS DerivedCls AS BaseCls
   HIDDEN Z         && The hiding element from subclasses
   Z = “*”
ENDDEFINE

Parameter Passing by Value

Visual FoxPro

ABC(x)

–or–

DO ABC WITH (x)

Parameter Passing by Reference

Visual FoxPro

ABC(@x)

–or–

DO ABC WITH x

Structured Exception Handling

Visual FoxPro

TRY
   IF x = 0
      THROW "x equals zero"
   ELSE
      THROW "x does not equal zero"
   ENDIF
CATCH TO err
   MESSAGEBOX("Error: " + err.UserValue)
FINALLY
   MESSAGEBOX("Executing finally block.")
ENDTRY

Set an Object Reference to Nothing

Visual FoxPro

MyObj = null

-or-

MyObj = .NULL.

Initializing Value Types

Visual FoxPro

LOCAL ltDateTime AS DateTime 
ltDateTime = DATETIME(2001, 4, 12, 22, 16, 49) 

  

Data Types Compared in Different Languages

Storage size

Visual Basic

Visual J#

Visual C++

C# NEW

JScript

Visual FoxPro

(varies)

String NEW (.NET Framework class)

java.lang.String or System.String

n/a

string

String NEW

VarChar

1 byte

Byte

byte

BYTE, bool

byte

byte NEW

Integer

2 bytes

Boolean

boolean

VARIANT_BOOL

bool

boolean NEW

Logical

4 bytes

Single

float

float

float

float NEW

Float

8 bytes

Double

double

double

double

double NEW

Double

  

Operators Compared in Different Languages

For details about operators in this language

See

Visual FoxPro

Visual FoxPro Operators

 

Visual Basic

Visual J#

C++

C# NEW

JScript

Visual FoxPro

  Modulus (division returning only the remainder)

Mod

%

%

%

% (also works with floating point)

%, Mod

  Not equal

<> 

!=

!=

!=

!=

<>,` #,  !=

  Compare strings

=

String.equals()

(There are functions to compare and concatenate strings)

==

-or-String.Equals()

==

=, ==

  Shortcircuited Boolean AND

AndAlso

&&

&&

&&

&&

AND, .AND.

  Array element

()

[ ]

[ ]

[ ]

[ ]

[ ], ()

  Logical-NOT

Not

!

!

!

!

!, NOT, .NOT.

  Bitwise-inclusive-OR

Or

|

|

|

|

BITOR()

  Logical-AND

And

&&

&&

&&

&&

AND, .AND.

  Logical-OR

Or

||

||

||

||

OR, .OR.

               

  

Controls and Programmable Objects Compared in Different Languages and Libraries

Visual Basic 6.0 object

Windows Forms control NEW

ASP.NET server control NEW

HTML server control NEW

MFC class

ATL class

Visual FoxPro object

Animation

Images on controls support animated GIFs

n/a

n/a

CAnimateCtrl

n/a

Image

PictureBox

PictureBox

Image

HtmlInputImage

CPictureHolder

n/a

Image