This table is a cross reference between jBC Basic commands and the equivalent functionality in Visual Basic using OBjEX. For each command that is applicable there is a reference to either a Visual Basic Intrinsic or to an OBjEX method.
JBC | Visual Basic with OBjEX |
---|---|
ABORT | Stop/End |
ABS() | Abs() |
ALPHA() | Like |
ASCII | n/a |
ASSIGNED() | IsEmpty() / IsObject |
BITCHANGE | n/a |
BITCHECK | n/a |
BITLOAD | n/a |
BITRESET | n/a |
BITSET | n/a |
BREAK | Exit Do |
CALL | Call or to call a jBC Subroutine, Call Method |
CASE | Select Case |
CHAIN | n/a |
CHANGE | Change Method |
CHAR() | Chr() |
CHDIR() | ChDir |
CHECKSUM() | n/a |
CLEAR | n/a |
CLEARFILE | Clearfile Method |
CLOSE | Set = Nothing |
COMMON | jCommon |
COL1() & COL2() | Part of Field Method |
COLLECTDATA | n/a |
CONTINUE | n/a |
CONVERT | Convert Method |
COS | Cos() |
COUNT() | Count Method |
CRT | n/a |
DATA | n/a |
DATE() | Date Property |
DCOUNT() | DCount Method |
DEBUG | n/a |
DEFC | n/a |
DEL | Del Method |
DELETE | Delete Method |
DELETELIST | Deletelist Method |
DIMENSION | Dim |
DTX() | Hex() |
EBCDIC() | n/a |
ECHO | n/a |
ENTER | n/a |
EQUATE | #Const |
EXECUTE | Execute Method |
EXIT() | End |
EXP() | Exp() |
EXTRACT | Extract Method |
FIELD() | Field Method |
FIND | Find Method |
FINDSTR | FindStr Method |
FOOTING | n/a |
FOR | For |
GETCWD() | CurDir() |
GETENV() | Environ() |
GETLIST | Getlist Method |
GOSUB | Call() |
GO(TO) | GoTo |
GROUP() | Field Method |
HEADING | n/a |
ICONV() | IConv Method |
IF | If |
IN | n/a |
INDEX() | Index Method |
INPUT | n/a |
INPUTNULL | n/a |
INS | Ins Method |
INT() | Int() or Fix() |
LEN() | Len() |
LN() | Log() |
LOCATE | Locate Method |
LOCK | n/a |
LOOP | Do or While |
MAT | For Each or Erase |
MATCH(ES) | Like |
MATBUILD | Matbuild Method |
MATPARSE | MatParseDynArrays Method |
MATREAD | Read Method followed by MatparseDynArrays Method |
MATREADU | ReadU Method followed by MatparseDynArrays Method |
MATWRITE | Matbuild Method followed by Write Method |
MATWRITEU | Matbuild Method followed by Write Method |
MOD() and REM() | Mod() |
NOT() | Not |
NULL | n/a |
NUM() | Is Numeric() |
OCONV() | Oconv Method |
ON . . . GOSUB | On . . . GoSub |
ON . . . GOTO | On . . . GoTo |
OPEN | Open Method |
OUT | n/a |
PAGE | n/a |
PERFORM | Execute Method |
PRECISION | Precision Property |
n/a | |
PRINTER ON/OFF/CLOSE | n/a |
PRINTERR | n/a |
PROCREAD | n/a |
PROCWRITE | n/a |
PROGRAM | n/a |
PROMPT | n/a |
PUTENV() | n/a |
PWR() | ^ Operator |
READ | Read Method |
READLIST | Getlist Method |
READNEXT | Readnext Method |
READT | n/a |
READU | ReadU Method |
READV | ReadV Method |
READVU | ReadVU Method |
REGEXP | Like |
RELEASE | ReleaseLock Method and ReleaseAllLocks Method |
REMOVE | use Extract Method |
REPLACE | Replace Method |
RETURN | End Sub/Exit Sub |
REWIND | n/a |
RND | Rnd() |
RQM | n/a |
RTNDATA | n/a |
SELECT | Select Method |
SENTENCE | Command() |
SEQ() | Asc() |
SIN() | Sin() |
SLEEP | Call Sleep |
SORT() | Sort Method |
SOUNDEX() | n/a |
SPACE() | Space() |
SQRT | Sqr() |
STOP | Exit |
STR() | String()/(1st character only) |
SUBROUTINE | Sub |
SYSTEM | n/a |
TAN() | Tan() |
TIME() | Time Property |
TIMEDATE() | Now() |
TRANSABORT | TransAbort Method |
TRANSEND | TransEnd Method |
TRANSQUERY | TransQuery Method |
TRANSTART | TransStart Method |
TRIM() | Trim Method |
TRIMB() | Trim Method |
TRIMF() | Trim Method |
UNASSIGNED | IsEmpty()/IsObject |
UNLOCK | n/a |
WEOF | n/a |
WRITE | Write Method |
WRITELIST | Writelist Method |
WRITET | n/a |
WRITEU | WriteU Method |
WRITEV | WriteV Method |
WRITEVU | WriteVU Method |
XTD() | n/a |
Some of the common problems encountered by Basic programmers migrating to VB and OBjEX
It is important to read the VB documentation and understand the way that errors are handled in Visual Basic. In particular when you disable the default error handler (which aborts the program) ensure that you can handle all possible errors that can occur until you re-enable the default handler. One error to be particularly aware of is that any attempt to access an uninitialized object reference will cause an error rather than a familiar message of the form "Uninitialized variable - Zero Used"
Object variables that are declared in a VB program are just variables that can contain references to objects. They are effectively uninitialized variables until they are set to reference an object either as the result of a method on another object or as the result of a new operation. So make sure you do not attempt to use them as source operands until they refer to an object that actually exists.
All references to objects have to be stored by the Set statement. If you omit the Set and create just an assignment statement then VB will attempt to assign the current default value of the object to the target variable.
Set MyDynArray = MyFile.Read(MyItemID)
Will make MyDynArray a reference to the jDynArray object that is
created by the Read method. If MyDynArray was referencing an object
prior to the Set statement then that object would be released if there were
no other references to it.
MyDynArray = MyFile.Read(MyItemID)
Will assign the string value of the dynamic array to the MyDynArray variable. If the MyDynArray actually references a existing dynamic array then the existing data will be overwritten by the string data converted back into a dynamic array. In effect the following will occur:
Set TempjDynArray = MyFile.Read(MyItemID) |
Creates a temporary object |
TempString = TempjDynArray.Value() |
Takes string value of object |
MyDynArray.Value = TempString |
Overwrites value with string |
This may appear to be achieving the desired result but it will fail if the reference is null and is doing far more work than it needs to.
A Basic program would typically initialize dynamic arrays to, and test for, the null value in many circumstances. Using OBjEX , dynamic arrays are accessed through "references" that introduce a level of indirection creating two possible ways of representing null dynamic arrays.
1. As a null reference.
Methods that return jDynArray Object references will return a null reference
when they fail to obtain the desired jDynArray (and cause an error). Code that
tests for the existence of a record, for example, should use the IsObject()
function to check for null references rather than looking for null dynamic
arrays. The Set jDynArrayreference = Nothing statement should be used to set a
reference to the null state.
2. As a reference to a jDynArray object with the value ".
Code that builds dynamic arrays from scratch should create the array using the
new operator before accessing it.
Set jDynArrayreference = New jDynArray
This statement will release the current object (if any), create a jDynArray object and initialize it to the null state.
File | Description |
---|---|
OBjEX30.dll | OBjEX dynamic link library |
OBjEX30.tlb | OBjEX type library |
OBjEX30.gid | OBjEX unique identifier |
OBjEX30.hlp | OBjEX help pages |
OBjEX30.cnt | OBjEX help contents |
OBJEX