• Welcome to PlanetSquires Forums.
 

"PERIOD NOT ALLOWED

Started by Kevin Warne, January 20, 2010, 09:09:39 PM

Previous topic - Next topic

Kevin Warne

hI all,

I open the tutorial1 - Logon project. When I compile the project I have an error:
"ERROR 526 PERIOD NOT ALLOWED"
module1.[myMessage] "Hello Tom from Module1"

how do i fix it please?

Regards,
K W

Paul Squires

FireFly3 does not ship with a "Tutorial 1" so I assume you must be talking about the tutorial file that comes with FireFly2?

Quote
module1.[myMessage] "Hello Tom from Module1"

I have no idea where that is coming from. I have never written code like that. Either you have some corrupted files or you are trying to open a non-FireFly project?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Kevin Warne

When I install FireFly3 upgrade the tutorial1 folder of FireFly 2 is intact under FireFlyYes, I loaded this from tutorial1. FireFly scanned and converted the project successfully.

I must have changed the tutorial to test the button - it works under FireFly2. The module detail is like this:

name: Module1.inc

It has a sub:

Sub myMessage (msg As String)
    MsgBox msg
   
End Sub

I have the error when I compile the project.

How do you call a sub/function in a module from code in a form? the compiler complains the dot between module name and function name.

regards,
KW

Kevin Warne

Quote from: TechSupport on January 20, 2010, 10:14:31 PM
FireFly3 does not ship with a "Tutorial 1" so I assume you must be talking about the tutorial file that comes with FireFly2?

Quote
module1.[myMessage] "Hello Tom from Module1"

I remove the module name - 'module1' - just use sub name myMessage
myMessage "Hello Tom from Module1" , it compiled.

My question now is if I many modules, some the sub/ function names are identical. How do I differentiate them?

Even I have FireFly2 but never write serious code, I start learning FireFly as I take over FireFly/PowerBasic projects from my workmate.

regards,
KW 

I have no idea where that is coming from. I have never written code like that. Either you have some corrupted files or you are trying to open a non-FireFly project?

Rolf Brandt

Hi Kevin,

could you post the project?
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Ivan Iraola

Try changing the name of the SUB or FUNCTION, some names in FF3 will not work, for example, if you create something like:

SUB Start

      MsgBox 
"Hello, just testing"

END SUB

You will get an error during compilation because START is being used by FF3 itself in some of the CODEGEN files.
Android App Developer
http://www.uncledroid.com

David Kenny

Kevin,

In FF, modules are only files to hold code (of course, I like to rename the module to indicate what type of routines are in it). The name of the module is not used past that.  In your situation, Module1.inc contains a sub called myMessage.  It could be in any module.

No matter where you put it, you still would call the routine by only it's name. Instead of: module1.[myMessage] "Hello Tom from Module1"try: myMessage "Hello Tom from Module1"

David

David Kenny

Kevin,

I reread your last post.  I hadn't noticed that you solved it yourself. You inserted your comments into a quote.  A quote would normally only include an actual quote, not your comments about the quote.

Never the less, you found exactly what I was trying to explain.

In answer to your next question: If I many modules, some the sub/ function names are identical. How do I differentiate them?

All subs/functions have to have unique names.  You can do exactly as your example showed, but stay away from using the period to separate the module name from the function name. Periods are reserved for other uses in PowerBasic.

In the module 'Module.inc', for instance, you could name that 'myMessage' sub 'Module_myMessage'.  And then you could have another module 'Module2.inc', and the sub name of 'Module2_myMessage'.

That being said, I believe that subs/functions should be named to such that the name indicates to you what it does.  Why would you have two subs/functions with the same name?

David

Kevin Warne

In the module 'Module.inc', for instance, you could name that 'myMessage' sub 'Module_myMessage'.  And then you could have another module 'Module2.inc', and the sub name of 'Module2_myMessage'.

That being said, I believe that subs/functions should be named to such that the name indicates to you what it does.  Why would you have two subs/functions with the same name?
.

I only want to know how to reference them. Of course it is silly to have the same name even in different modules.

I atttached the project in question.

Thank you David and all

Paul Squires

I downloaded the project. It is the FireFly 2 tutorial project. It converted perfectly into FireFly3 and I was able to compile and run it with no trouble. Is there anything in particular about the project that you are having trouble with?
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

David Kenny

Sorry Kevin,

We are not understanding each other somehow. 

You wrote this earlier today:
QuoteMy question now is if I many modules, some the sub/ function names are identical. How do I differentiate them?
And then you just said:
QuoteOf course it is silly to have the same name even in different modules.

You also just said:
QuoteI only want to know how to reference them.
You already demonstrated that you know how to call the sub now.  What other way are you wanting to 'reference' it?

The project you posted seems to be a 'stock' demo.  It doesn't have the module or sub you had questions about and it compiles and runs fine.

David

Kevin Warne

Hi Paul,

The attached project has no problem as  I removed my test code.

I have problem before as I add a module named 'module1' and a sub name 'myMessage' and I call this sub from the button 'OK'  like this ' module1.myMessage'. The compiler complains that the period is not allowed. I remove the module and period before the sub name (module1.) just call it like: myMessage and It compiled OK.

I simply try to find out the syntax of  how to refer a sub/function  in modules from a from.

Thankyou,
KW

Paul Squires

Quote from: Kevin Warne on January 21, 2010, 08:19:37 PM
Hi Paul,

The attached project has no problem as  I removed my test code.

I have problem before as I add a module named 'module1' and a sub name 'myMessage' and I call this sub from the button 'OK'  like this ' module1.myMessage'. The compiler complains that the period is not allowed. I remove the module and period before the sub name (module1.) just call it like: myMessage and It compiled OK.

I simply try to find out the syntax of  how to refer a sub/function  in modules from a from.

Thankyou,
KW

Ah, yes, now I understand. The use of a period is a kind of Visual Basic or .Net approach. In PB, you can not create static obj's or namespaces so all subs/functions need to have unique names without periods.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Kevin Warne

Quote from: David Kenny on January 21, 2010, 08:12:48 PM
Sorry Kevin,

We are not understanding each other somehow. 

You wrote this earlier today:
QuoteMy question now is if I many modules, some the sub/ function names are identical. How do I differentiate them?
And then you just said:
QuoteOf course it is silly to have the same name even in different modules.

You also just said:
QuoteI only want to know how to reference them.
You already demonstrated that you know how to call the sub now.  What other way are you wanting to 'reference' it?

The project you posted seems to be a 'stock' demo.  It doesn't have the module or sub you had questions about and it compiles and runs fine.

David

Thanks David.
I found out after I posted my question. I wonder if a function maybe is called many ways -I only try to learn coding syntax and convention. I have searched the help but has not found much.
The project was a purely demo of FireFly2.  I post it as requested by one of a response.

Regards,
KW