I have named 'strfilename' as a public variable in the main module. That variable contains the name of the file I will be using within my app.
I have created a second module named ModPPC1
I added a sub named 'startinverse8' to the second module
Within startinverse8, I want to open 'strfilename' and do things.
Here are some snippets of code:
I have to use the code noted above to make it work. 'strbearing' is a required parameter but why do I have to use 'strfilename' if I already declared it as public? If I don't, I get an error message saying "strfilename is not assigned any value" although earlier in my code I made sure an actual file name was assigned.
Also, if I had declared the sub 'startinverse8' as public, could I then just name it without using 'callsub' ? I have read the docs but maybe don't fully understand them the way I should. Thanks, guys, for any help or further explanation.
Jim Schuchert
I have created a second module named ModPPC1
I added a sub named 'startinverse8' to the second module
Within startinverse8, I want to open 'strfilename' and do things.
Here are some snippets of code:
B4X:
Sub Globals
'Declare the global variables here.
Public strfilename [color=green]'declaration of public for variable[/color]
Public strfilelist
Public coord(4)
Public strbearing,strbear,strfrpoint,strdesc,strpointno,strdes
Public intcounter,strdistance
radian=0.017453292
radianreverse=1/radian
numer=""
End Sub
Sub App_Start
If Not (FileExist ("filelist.txt")) Then
FileOpen (f,"filelist.txt",cWrite,,cASCII)
B4X:
'this is where a file is assigned to strfilename
Sub lstStart_SelectionChanged (Index, Value)
txtstartfilename.Text =value
[color=red]strfilename=txtstartfilename.Text & ".txt"[/color]
FileOpen(f3,strfilename,cWrite,cAppend )
Msgbox(strfilename & " has been opened for cogo operations")
FileClose(f3)
'frmstart.close
frmmenu.Show
End Sub
B4X:
'from the calling sub in the main module
strBearing = sPoint1 & "*" & sPoint2
[color=red]CallSub ("modppc1.startinverse8",strbearing,strfilename)[/color]
end if
end sub
B4X:
'from the sub in modppc1
Sub startinverse8(strbearing,[color=red]strfilename[/color])
FileClose(c)
FileOpen(c, strfilename,cRead)
pintcntr = StrIndexOf(strBearing, "*",0)
firstpt = SubString(strBearing, 0, pintcntr)
I have to use the code noted above to make it work. 'strbearing' is a required parameter but why do I have to use 'strfilename' if I already declared it as public? If I don't, I get an error message saying "strfilename is not assigned any value" although earlier in my code I made sure an actual file name was assigned.
Also, if I had declared the sub 'startinverse8' as public, could I then just name it without using 'callsub' ? I have read the docs but maybe don't fully understand them the way I should. Thanks, guys, for any help or further explanation.
Jim Schuchert