VB.NET Compatibility

Started by Frank Manning May 16, 2004
Starting with the V2.1 BasicX IDE, a number of language
extensions were added for subset-compatibility with VB.NET:

1. The following statements and functions are legal
in BasicX:

CType
Imports
Module/End Module
Option Strict
Console.Write/WriteLine (replaces Debug.Print)

2. Since VB.NET offers only limited support for
nonzero-based arrays, array dimensions can be
declared by specifying only the upper bound for
each dimension. Lower bounds default to zero.
Note that this change retains VB6 compatibility.

3. Parameterized constructors are new in VB.NET.
BasicX block data classes were upgraded to
allow constructors, which simplify
declarations:

Dim B As New SingleTableData("X.dat")

Constructors are easier to use than the
previous Source method.

Note that most of the extensions listed above are incompatible
with VB6. Similarly a number of VB6 features in BasicX (such as
Debug.Print) are not compatible with VB.NET.

BasicX tends to be permissive about VB6 vs. VB.NET extensions. It
is possible to write a program that will compile without change
in both BasicX and VB.NET. The same applies to BasicX and VB6.
However, because of incompatibilities between VB6 and VB.NET, a
given program won't compile in all three compilers. Known bugs and limitations:

1. BasicX is overly permissive with Imports statements, and does
not check for errors in imported namespaces.

2. Block scoping of local variables is not supported. Local
variables should be declared at the beginning of a subprogram if
you also want VB.NET compatibility.

3. BasicX's Integer and Long types are 16 bits and 32 bits long
respectively, compared to 32 bits and 64 bits for the same types
in VB.NET. For these types, numeric values that are legal in
BasicX are still legal in VB.NET.

4. Zero-based arrays can be passed to system library subprograms,
but not to user-written subprograms, which can accept only
one-based arrays. In other words, it is impractical to pass
arrays as parameters to user-written subprograms if you also want
VB.NET compatibility.

-- Frank Manning
-- NetMedia, Inc.



Thank you Frank,

Very interesting, I've written all classes in VB6 to simulate BasicX 2.1 but was wondering how to do parameterized constructors, and how it fitted into the VB/BasicX compatibility issue (I don't know anything about VB.NET).

If anyone is interested in the classes, I'll post the to files section or even place them on the documentation project.

Steve ;-)

-----Original Message-----
From: Frank Manning [mailto:]
Sent: 16 May 2004 23:11
To:
Subject: [BasicX] VB.NET Compatibility Starting with the V2.1 BasicX IDE, a number of language
extensions were added for subset-compatibility with VB.NET:

1. The following statements and functions are legal
in BasicX:

CType
Imports
Module/End Module
Option Strict
Console.Write/WriteLine (replaces Debug.Print)

2. Since VB.NET offers only limited support for
nonzero-based arrays, array dimensions can be
declared by specifying only the upper bound for
each dimension. Lower bounds default to zero.
Note that this change retains VB6 compatibility.

3. Parameterized constructors are new in VB.NET.
BasicX block data classes were upgraded to
allow constructors, which simplify
declarations:

Dim B As New SingleTableData("X.dat")

Constructors are easier to use than the
previous Source method.

Note that most of the extensions listed above are incompatible
with VB6. Similarly a number of VB6 features in BasicX (such as
Debug.Print) are not compatible with VB.NET.

BasicX tends to be permissive about VB6 vs. VB.NET extensions. It
is possible to write a program that will compile without change
in both BasicX and VB.NET. The same applies to BasicX and VB6.
However, because of incompatibilities between VB6 and VB.NET, a
given program won't compile in all three compilers. Known bugs and limitations:

1. BasicX is overly permissive with Imports statements, and does
not check for errors in imported namespaces.

2. Block scoping of local variables is not supported. Local
variables should be declared at the beginning of a subprogram if
you also want VB.NET compatibility.

3. BasicX's Integer and Long types are 16 bits and 32 bits long
respectively, compared to 32 bits and 64 bits for the same types
in VB.NET. For these types, numeric values that are legal in
BasicX are still legal in VB.NET.

4. Zero-based arrays can be passed to system library subprograms,
but not to user-written subprograms, which can accept only
one-based arrays. In other words, it is impractical to pass
arrays as parameters to user-written subprograms if you also want
VB.NET compatibility.

-- Frank Manning
-- NetMedia, Inc. <http://companion.yahoo.com>" target="_blank" rel="nofollow">http://rd.yahoo.com/SIG9tdm0ma/M)5196.4901138.6071305.3001176/D=groups/S06554205:HM/EXP84835246/A!28215/R=0/SIGse96mf6/*http://companion.yahoo.com> click here
<http://us.adserver.yahoo.com/l?M)5196.4901138.6071305.3001176/D=groups/S=:HM/A!28215/randb6615337 _____

> .
This email is intended only for the above named addressee(s). The information contained in this email may contain information which is confidential. The views expressed in this email are personal to the sender and do not in any way reflect the views of the company. If you have received this email and you are not a named addressee, please contact the sender and then delete it from your system.


--- In , "Frank Manning" <fmanning@n...> wrote:
> Starting with the V2.1 BasicX IDE, a number of language
> extensions were added for subset-compatibility with VB.NET:
>
> 1. The following statements and functions are legal
> in BasicX:
>
> CType
> Imports
> Module/End Module
> Option Strict
> Console.Write/WriteLine (replaces Debug.Print)
>

I have V2.1 of the IDE and can't get any of these to work. If I
understand the syntax correctly, the following should work:

Dim b as Byte
Dim i as integer

b = Ctype(Byte, i)

However, this generates an error when I compile.

I did figure out Module/End Module, Option Strict and Console.Write
(). They seem to work.

On the other hand, Imports didn't do what I expected. I thought I
should be able to do this:

Imports Register
Sub foo()
Dim b as Byte
b = TCNT0
End Sub

I also tried b = .TCNT0 like you would use in conjuction with the
With/End With. That didn't work either.

Can anyone enlighten me or point me to some documentation?

Thanks



--- In , "Don Kinzer" <dkinzer@e...> wrote:
> --- In , "Frank Manning" <fmanning@n...>
wrote:
> Dim b as Byte
> Dim i as integer
>
> b = Ctype(Byte, i)

Update...

It appears that Ctype may only work with enumerations, used to
convert an integer value to an enumeration value.

Enum Color
Red
Blue
End Enum

Dim c as Color

c = CType(2, Color)