CS1026 error when calling sub

Mornixuur

Member
Licensed User
Hi,

Probably a newbie question but here it goes. I have a sub called search_app(tmp). When i pass a string constant everything is ok but if i pass a variable i get error CS1026 when compiling (optimized mode, version 6.8).

Code:

====================================
sub search_app(tmp)
found = false

checking some stuff here....


return found
end sub

elsewhere i have

x = "test"
if search_app(x) then

end if
===============================

Anyone got a clue?
 

sitajony

Active Member
Licensed User
Hi, How do you call exactly this function? I think that the problem come from your function call...
 

Mornixuur

Member
Licensed User
I call the function inside an if statement like in the example code. What i try to do is iterate some dates and mark them with a dot if they exist in a list.

==== THIS WORKS==========================
If search_app("04/23/2010") Then
form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If


===THIS FAILS=============================

X = "04/23/2010"
If search_app(X) Then
form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If



Hi, How do you call exactly this function? I think that the problem come from your function call...
 

sitajony

Active Member
Licensed User
The error is not on your code... It work...
B4X:
X = "04/23/2010"
If search_app(X) Then
form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If

Maybe there's a same function name or variable name used for an other thing...

Test just this:
B4X:
Sub Globals
   'Declare the global variables here.

End Sub

Sub App_Start
X = "04/23/2010"
If search_app(X) Then
Msgbox("ok")
'form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If
End Sub
Sub search_app(tmp)
found = True

'checking some stuff here....


Return found
End Sub
If it work check your code, maybe the problem is elsewhere...

Edit: It's weird but try this if really it doesn't work:
B4X:
Sub App_Start
X = "04/23/2010"
state=search_app(X)
If state Then
Msgbox("ok")
'form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If
End Sub
Sub search_app(tmp)
found = True

'checking some stuff here....


Return found
End Sub
 
Last edited:

Mornixuur

Member
Licensed User
I wrote a simple test program which shows the same error. I think i am missing something basic here:


====================================================
Sub Globals
'Declare the global variables here.

End Sub

Sub test(aap)
found = True
Return found
End Sub

Sub App_Start
Form1.Show
x = 1
If test(x) Then
Msgbox("Lucky!")
End If

End Sub

=====================================================


Again if i change test(x) into test("something") it works....








I call the function inside an if statement like in the example code. What i try to do is iterate some dates and mark them with a dot if they exist in a list.

==== THIS WORKS==========================
If search_app("04/23/2010") Then
form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If


===THIS FAILS=============================

X = "04/23/2010"
If search_app(X) Then
form1.FCircle(x+32,y+50,7, 0,0,0,F)
End If
 
Last edited:

mjcoon

Well-Known Member
Licensed User
I thought it might be a problem with using underbar in a identifier wheras it has an assigned purpose as a line-extender.

Perhaps Erel could give us the exact rules about identifier construction and use of underbar.

Mike.
 

Mornixuur

Member
Licensed User
Sorry to have bothered you with this. Erel was right. My installation was faulty. He sorted me out and the weird error is gone. Thanks for your time anyway.
 
Top