Jabaco Notes For VB Developers

2/9/2011
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Visual BasicJabaco SupportSpecifics...
(declare)getprivateprofilestringDifferences Windows API call for reading values from INI files.
(declare)writeprivateprofilestringDifferences Windows API call for writing values to INI files.
absExact  
addressof   
and  Refer to operators
anyNone  
appNone Version 1.5.2

App.Path causes Unhandled Null Exception
App.EXEName returns nothing
arrayNone Not supported. In VB, the Array function can be used to create arrays in variant variables. Example:

  Dim sInfo As Variant
  sInfo = Array("1", "2", "three")
  MsgBox sInfo(2)
The above code outputs "three" when Option Base 0 is in use.
asExact  
ascExact  
atomic_datatype  Atomic Datatypes:

Boolean
Byte
Char
Date  -- See date_object
Double
Integer
Long
String
binary  Refer to file_handling
boolean  Refer to atomic_datatype
byrefNone Jabaco ByVal and ByRef keywords have no effect.

Apparently Jabaco considers all parameters as ByVal--modifications of parameters within the subroutine will never affect the values of the variables in the calling subroutine.

Therefore, calling ByVal has no effect. Also, calling ByRef has no effect--it does not override the ByVal behavior. At this point, there is no way to have a ByRef parameter in a Jabaco subroutine call.

A deeper concern the arises from this is: By default, VB considers subroutine and function parameters as ByRef. Jabaco's current "default" behavior is to consider all parameters ByVal. This could obviously change the runtime behavior or VB code imported into Jabaco.
byte  Refer to atomic_datatype
byvalNone Refer to byref
case  Refer to select..case
cboolDifferences CBool when used in VB will raise a "Type Mismatch" error (Or a "Invalid Use Of Null") when the supplied value cannot be converted to boolean.

Jabaco appears to convert values successfully (i.e. string "True" to boolean True), but does not raise errors for invalid values.
cdateNone Conversions of strings to dates unreliable
char  Refer to atomic_datatype
chdirNone Not currently supported.

See chdrive, curdir
chdriveNone Not currently supported.

See chdir, curdir
chrExact  
clngDifferences CLng when used in VB will raise a "Type Mismatch" error (Or a "Invalid Use Of Null") when the supplied value cannot be converted to boolean.

Jabaco appears to convert values successfully (i.e. string "123" to long 123), but does not raise errors for invalid values.
close  Refer to file_handling
commandNone Not supported.

VB: Command (Command$) function will return command line parameters.
constExact  
constants  The following Visual Basic constants have been implemented in Jabaco. This is not a complete list, but includes the constants I have verified...

vbCr
vbCrLf
vbKeyAdd
vbKeyDelete
vbKeyDown
vbKeyEnd
vbKeyEscape
vbKeyF1..12
vbKeyHome
vbKeyLeft
vbKeyNumpad0..9
vbKeyPageDown
vbKeyPageUp
vbKeyRight
vbKeyUp
vbKeyInsert
vbNo
vbYes
vbYesNo

vbDirectory: See getattr
createobjectNone Does not apply.

CreateObject in VB performs a late binding object instantiation of an ActiveX object.
cstrDifferences CStr converts values to strings in most cases, with the following exceptions:

MsgBox CStr(False)
VB: This statement returns "False"
J: This statement returns "0"

MsgBox CStr(Null)
VB: This statement raises "Invalid Use Of Null" error
J: This statement returns an empty string "".
curdirNone CurDir function not implemented in Jabaco.

VB: CurDir returns the current working directory, which can be changed by ChDir, ChDrive
date  Refer to atomic_datatype
date_objectDifferences There are currently many differences between VB and Jabaco concerning date handling.

1) In VB, there is an atomic data type "Date" which can be dimensioned as you would ay other type such as Integer, etc. A VB Date type holds a date/time value. In Jabaco, a "Date" is currently a reference to the Java "date" object type, which has a different functionality.
VB: Dim MyDate as Date
J:  Dim MyDate as Date
    Set MyDate = New Date
Although the above code would compile, the behavior or MyDate in Jabaco will not match the expected VB behavior.
datediffNone DateDiff function is not implemented.
dayNone Date functions are not reliable.
dimExact  
dirDifferences Dir does not appear to support wild cards. If a file "C:\test.txt" exists, and the following statement is executed:

sFile = Dir$("c:\*.txt")
Jabaco returns an empty string. VB would have applied the wildcard and found "test.txt"
However, it does successfully test the existence of a file in the case of sFile = Dir$("c:\test.txt")
do  Refer to do..loop_until
do..loop_untilExact Compatible, Exit Loop supported.
doeventsExact  
double  Refer to atomic_datatype
elseExact Applies to: if..then select..case
endNone Standalone "End" statement to terminate program appears to be unsupported. Use the following work-around:

VB: End
J:  system.exit(0)
enumExact Enum appears to be supported. The IDE tips may not suggest the Enum members in all cases.
eof  Refer to file_handling
erase  Refer to redim
errDifferences The Err object appears to be a java object, not a replication of the VB object. Code workarounds will be required.
error  Refer to on..error
eventExact Event appears to function well.

I have not tested Dim Withevents yet...
exitExact Applies to: do..loop_until for..next
file_handlingDifferences For basic file handling, the syntax and objects for opening, closing, reading, writing, and file modes is as follows:

VB: F=FreeFile
J:  Dim F as VBFileHandler

VB: Open "file.txt" For Output As #F
J:  F=Open("file.txt",Output,Write,Shared)

VB: Print #F,"hello"
J:  F.WriteString "hello"

VB: Input #F,sValue
J:  sValue=F.read

VB: Line Input #F,sLine
J:  sLine=F.readLine

VB: Close #F
J:  F.close

Jabaco also has additional file handling options, follow the tool tips of the VBFileHandler object.
filecopyExact  
filedatetimeNone Appears not to have been implemented in Jabaco.
filelenExact  
fixExact  
for  Refer to for..next
for..nextExact  
formatDifferences Format in VB is a catch-all statement, researching Jabaco equivalents now:
freefile  Refer to file_handling
functionExact  
get  Refer to file_handling
getattrDifferences Supported, but specifics unknown
goto  This entry refers to the Goto statement. For use with "error", see on..error.
hexExact  
hourNone Date functions are not reliable.
if  Refer to if..then
if..thenExact  
input_#f  Refer to file_handling
inputboxExact  
instrExact  
instrrevDifferences Functionality is the same. May require code changes if importing a VB project, as the start parameter is not optional if you are trying to specify the comparison type.
intDifferences Int appears to return an Integer value. This makes the "Int" function the same as the "CInt" function.

In VB, the "Int" function is the same as the "Fix" function.
integer  Refer to atomic_datatype
is  Refer to nothing
isdateNone Date functions are not currently reliable.
isnullDifferences Appears to detect nulls. Incorrectly returns true for a variant type that has not been defined.
   Dim x
   
   MsgBox IsNull(x) 'VB returns False, Jabaco returns True <-----
   
   x=Null
   MsgBox IsNull(x) 'VB returns True, Jabaco returns True
   
   x=123
   MsgBox IsNull(x) 'VB returns False, Jabaco returns False
isnumericExact  
joinExact  
killNone Appears to not work.

If you create a text file "C:\test.txt", then attempt the statement
Kill "C:\test.txt"
The file does not get deleted.
lcaseExact  
leftExact  
lenDifferences The Jabaco Len function expects a string, and returns length of strings properly.

The VB Len function also returns the byte length of any variable type, meaning the following are valid examples that do not work in Jabaco:
Dim x as Integer
Dim y as Long

MsgBox Len(x) 'should return 2
MsgBox Len(y) 'should return 4

Although there is little reason to support this for atomic data types, it is handy when trying to determine the length in bytes of a user defined Type.
letNone Let works properly when it is part of a Property declaration. However, the standalone "Let" statment is not supported.
  Dim x as Integer

  Let x=3

Obviously, most of us stopped using Let in this fashion about 40 years ago.
lineDifferences The line method works well, but the syntax is different than VB. Imported projects will need to be converted.
loadDifferences Someone research dynamic loading of controls at runtime for me?
loadpictureDifferences Loadpicture is supported by not exactly identical, returns a "resource" instead of a picture type. Will search the forums...
lof  Refer to file_handling
long  Refer to atomic_datatype
loop  Refer to do..loop_until
meExact  
midExact  
minuteDifferences Date functions are not currently reliable.
mkdirDifferences MkDir appears to make directories successfully. However, it does not raise a runtime error when the target directory already exists.
mod  Refer to operators
monthDifferences Date functions are not currently reliable.
msgboxExact  
newDifferences New appears to be optional in Jabaco, meaning objects are automatically instantiated when used. Possible the new keyword is simply ignored. In VB, the following would fail:
Dim x as SomeClass
x.SomeMethod="hello"
In Jabaco, it appears that the first reference to x will instantiate the class, whereas in VB the following would have been required:
Dim x as New SomeClass
next  Refer to for..next
not  Refer to operators
nothingNone "is nothing" when referencing an object variable appears to always return True.
nowDifferences Date functions are not currently reliable.
on  Refer to on..error
on..errorDifferences Appears supported, but in general it is very hard to get Jabaco to throw an error. Example:
On Error goto MathError

  x = 1/0

  MsgBox "should not see this."
  exit sub

MathError:
  MsgBox "error handled."

The above example does not display "error handled" as expected. Nor does it raise a division by zero error.
open  Refer to file_handling
operatorsExact Arithmetic as well as bitwise operators appear valid, including Mod, Not.
optionalDifferences Optional parameter works. However, in function calls the "middle" parameters cannot be left out as expected. With a function declared as:
Private Function AddNumbers(a As Integer, b As Integer, Optional c As Integer=0, Optional d As Integer=0, Optional e As Integer=0) As Integer

...the last statement below will not compile:
MsgBox AddNumbers(1,2)
MsgBox AddNumbers(1,2,3)
MsgBox AddNumbers(1,2,,5)    '<--will not compile
or  Refer to operators
paramarrayNone ParamArray keyword is recognized by the IDE, but does not appear to correspond to the VB statement. The function declaration below will not compile:
Private Function AddNumbers(ParamArray A()) as Integer

In VB, a ParamArray is an array, denoted by the () after the variable name. VB does not allow a datatype to be specified, ParamArrays are always of type variant.
popupmenu  No documentation for this topic.
preserve  Refer to redim
print  No documentation for this topic.
print_#f  Refer to file_handling
private  No documentation for this topic.
public  No documentation for this topic.
put  Refer to file_handling
raiseevent  No documentation for this topic.
redimExact Dim, Redim, and Erase (for dynamic arrays) are supported.
replace  No documentation for this topic.
resume  No documentation for this topic.
right  No documentation for this topic.
rmdir  No documentation for this topic.
rnd  No documentation for this topic.
second  No documentation for this topic.
select  Refer to select..case
select..caseDifferences Select, Case, and Case Else all work as expected. However, defining ranges using the "To" keyword is not supported:

Select Case sValue
  Case 1 'Supported
  Case 2,3,4 'Supported
  Case 5 to 10 'NOT SUPPORTED
  Case Else 'Supported
End Select
set  No documentation for this topic.
shell  No documentation for this topic.
single  No documentation for this topic.
space  No documentation for this topic.
splitExact  
static  No documentation for this topic.
step  Refer to for..next
stop  No documentation for this topic.
strconv  No documentation for this topic.
string  Refer to atomic_datatype
string_function  No documentation for this topic.
sub  No documentation for this topic.
then  Refer to if..then
timer  No documentation for this topic.
to  Applies to: for..next select..case dim redim
trim  No documentation for this topic.
type  No documentation for this topic.
ubound  No documentation for this topic.
ucase  No documentation for this topic.
unload  No documentation for this topic.
until  Refer to do..loop_until
val  No documentation for this topic.
variant  No documentation for this topic.
vbkeypause  No documentation for this topic.
vbkeysubtract  No documentation for this topic.
vblf  No documentation for this topic.
vbminimized  No documentation for this topic.
vbokonly  No documentation for this topic.
vbstring  No documentation for this topic.
vbtab  No documentation for this topic.
vbtextcompare  No documentation for this topic.
vbunchecked  No documentation for this topic.
weekday  No documentation for this topic.
wend  Refer to while..wend
while  Refer to while..wend
while..wend  No documentation for this topic.
with  No documentation for this topic.
withevents  Refer to event

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z