pjetson Member Licensed User Longtime User Aug 9, 2017 #1 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: Code: 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: Code: 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: Code: 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?
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: Code: 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: Code: 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: Code: 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 Aug 9, 2017 #2 Try CallSub2(Main,"debugLog","QuickSetup code is blank or cancelled") Upvote 0
pjetson Member Licensed User Longtime User Aug 9, 2017 #3 Star-Dust said: Try CallSub2(Main,"debugLog","QuickSetup code is blank or cancelled") Click to expand... Is that the only way? It seems a very messy syntax. Upvote 0
Star-Dust said: Try CallSub2(Main,"debugLog","QuickSetup code is blank or cancelled") Click to expand... Is that the only way? It seems a very messy syntax.
Erel B4X founder Staff member Licensed User Longtime User Aug 9, 2017 #4 Move the public methods to a code module (not activity or service). This will allow you to call them directly. Upvote 0
Move the public methods to a code module (not activity or service). This will allow you to call them directly.