strbearing=modppc1.strdeg
If StrLength(strbearing) = 5 Then
CallSub("modppc1.convertangle",strbearing, 1, 1, 2, 2, 4, 2)
End If
Here is the sub being called from module "modppc1"
B4X:
Sub convertangle(strbearing, a, b, c, d1, E, f)
'Dim stenths, icntr, dsnum, dtenths
intDnum = SubString(strBearing, a, b)
intmnum = SubString(strBearing, c, d1)
intsnum = SubString(strBearing, E, f)
dblAngle = intDnum + intmnum / 60 + intsnum / 3600
skipnext:
If StrIndexOf(strBearing, "-",0) > 0 Then _
dblAngle = dblAngle * (-1)
End Sub
"strbearing" is a global variable declared in the main module as public
"strdeg" is a global variable declared in modppc1 module. Neither are declared anywhere else so I don't know which 'local' variable is referred to in the message "local variable cannot hide global variable". This code works in other versions of basic.
Thanks, Klaus, but I tried that already and it throws a syntax error. I know the problem is in that line but can't pinpoint it. Apparently the parameters are causing the error.
When I remove the parameters from the sub, it doesn't choke. I am going to revise my code so that it only looks at "strbearing" for the manipulations I will make. If I still have problems, I will post the code. Thanks for your time.
I think you can only get that error message when you name a parameter the same as a global variable. The error message is slightly misleading but the parameter names are actually declarations of local variables. If you refer to a global variable name anywhere else in a Sub then it uses the global and doesn't declare a new local variable.
Perhaps the error should be "Parameter name cannot hide global variable name".