You are not logged in.

niranjan

Beginner

  • "niranjan" started this thread

Posts: 2

Date of registration: Sep 8th 2010

  • Send private message

1

Wednesday, September 22nd 2010, 6:56pm

paramarray & array are not working in jabaco

Hi!!
Very recently i started using jabaco.Initially i felt jabaco is the best ide. Now i have problems with the built-in functions and sub-routines such as array(), paramarray etc.,,
Can some body help me.. :(
Kindly go through the following code snippet

Public Sub command1_Click()
Dim v, x%
v = Array(1.5,2.5,3.5)
Print "Now the values of the array are:";
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2);
Next
Print
v = Array(45, 34, 87, 56, 21)
Print "Now the values of the array are:";
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2);
Next
Print
v = Array("nir", "anjan", "tejas", "babji")
Print "Now the values of the array are:";
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2);
Next
Print
End Sub

OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Thursday, September 23rd 2010, 2:05am

Hi,

Yes, Jabaco has some problems with this VB-kind of code, let's have a look at every single detail:

Jabaco does have the datatype Variant and it works pretty good even for Arrays!

Datatype Variant with array inside and initialisation with function Array:

(VB-Code) instead of

Jabaco Source

1
Dim v(): v() = Array(1, 2, 3)

(Jabaco-Code) just use

Jabaco Source

1
Dim v() = (1, 2, 3)


once initialised you can not redefine it again (like u could do in VB), because the initialisation and the definition of the array variable in Jabaco is coupled together in one line, but you can of course use a second array variable and assign it:

(VB-Code) instead of

Jabaco Source

1
2
3
4
Dim v()
v() = Array(1, 2, 3)
v() = Array("A", "B", "C")
Debug.Print v(0)

(Jabaco-Code) you could use

Jabaco Source

1
2
3
4
Dim v() = (1, 2, 3)
Dim v2() = ("A", "B", "C")
v = v2
Debug.Print v(0)


The Print-Command:

There is a Sub in the Form class called Print that takes a String and draws it onto the Form. But there is no possibility for the syntax with the ";"-char after the Print-Command, ( ; means let the next string begin after the old position in the old line)

the following code should work:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Sub Command1_Click()
Dim v() = (1.5, 2.5, 3.5)
Dim x%
Print "Now the values of the array are:",
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2)
Next
Print ""
Dim v2() = (45, 34, 87, 56, 21)
v = v2
Print "Now the values of the array are:"
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2)
Next
Print ""
Dim v3() = ("nir", "anjan", "tejas", "babji")
v = v3
Print "Now the values of the array are:"
For x = LBound(v) To UBound(v)
Print v(x) & Space$(2)
Next
Print ""
End Sub




regards

OlimilO

Rate this thread
WoltLab Burning Board