-
Option Base 1
Sub program(choice As Integer)
Print "I"
If choice = 0 Then
Print "am"
Else
Print "drink"
End If
End Sub
Private Sub Command1_Click()
Dim x As Integer
Dim wArray(5) As String
wArray(1) = E
wArray(2) = V
wArray(3) = I
wArray(4) = A
wArray(5) = N
Call iysam(2)
For x = 1 To 5
Print wArray(x)
Next x
Call iyam(0)
For x = 5 To 1 Step -1
Print wArray(x)
End Sub
when i run it i get a error on the call iysam(2).And when i put iyam after Sub Program it gives me a error too.
like this :Sub program iyam(choice As Integer)-gets a error
-
You need to drop the program from the sub call and name it iysam() like so:
Your code now =
Sub program (choice as integer)
Your code should =
Sub iyam(Choice!)
Then you can pass any variable of the specified type to that sub.
Either that or change the name in the call to
Call program(2)
instead of
Call iysam(2)
...later
-
thank you for the help so far.Right now when i press the start command button it prints
I
drink
I
am
Its supose to also print the array after that.But the arrays aren't printing out.What did i do wrong?
-
Change Dim wArray(5) as String
to
Public wArray(5) as String
Then try this in the Sub iysam(Choice!):
Print "I"
If choice = 0 Then
Print "am"
Print wArray(Choice!)
Else
Print "drink"
Print wArray(Choice!)
End If
End Sub
.......later
-
nope :( it gets a error with -Public wArray(5) as String
-
printing arrays is pretty hard :)