Android Question I'm having a problem with code modules

pjetson

Member
Licensed User
Longtime User
I have a B4A program that works, and I thought I would try to clean it up a little by moving some of the code out of the Main module into a couple of code modules.

However, now I'm getting this error message:
B4X:
Compiling code.  Error
Error compiling program.
Error description: Unknown member: debuglog
Occurred on line: 28
Main.debugLog("QuickSetup code is blank or cancelled")
Word: debuglog

Here's the code around line 28 of the QuickSetup code module:
B4X:
If (Ret = DialogResponse.CANCEL) Or (Id.Input = "") Then
     Main.ErrorBeep.Beep

     Main.debugLog("QuickSetup code is blank or cancelled")
    
     ToastMessageShow("Quick Setup cancelled", False)
     Return
End If

And here's the start of the debugLog sub in the Main module:
B4X:
Sub debugLog(TextToLog As String)
   Try
     Dim FW1 As TextWriter
     Dim FileName As String
     Dim Now As Long

I have Wyken's book, and it says "To call a sub in a code module, use a call like moduleName.subName", which is what I thought I was doing in the code above.

Added later: Am I having this problem because debugLog is in the Main module, not in a Code module? If so, how can I call code in the Main module from a Code module?
 

Star-Dust

Expert
Licensed User
Longtime User
Try
CallSub2(Main,"debugLog","QuickSetup code is blank or cancelled")
 
Upvote 0
Top