replace EndOfLine with EOL - SOLVED

Am busy working thru the Users Guides and quickly converting from VB6 thinking to Xojo. Really enjoying this !

Question : is it possible to add a global constant to a Module, that will allow me to use something in place of a ‘standard’ Xojo command.

For example, if I really don’t line typing ‘EndOfLine’ and I know I am going to be doing it a lot, can I create a Constant called ‘EOL’ so ‘EOL’ = EndOfLine, and in my msgbox code use : MsgBox “line 1” + EOL + “Line 2” ?

If there is a solution, I assume it should work for any standard command.

Regards

You could just make that a global method, it will work the same way as a constant with a dynamic value.

OK. So under the App, I have added ‘Methods’ and under that a Method ‘EOL as EndOfLine’
Scope is Public

But when I call in a msgbox :
msgbox str(tm1con1) + eol + str(tm2con1)

I get " This item does not exist " with ‘EOL’ highlighted.

it should be Method EOL as String

[quote=184058:@Dave OBrien]For example, if I really don’t line typing ‘EndOfLine’ and I know I am going to be doing it a lot, can I create a Constant called ‘EOL’ so ‘EOL’ = EndOfLine, and in my msgbox code use : MsgBox “line 1” + EOL + “Line 2” ?

If there is a solution, I assume it should work for any standard command.

[/quote]

  • Add an EOL computed property to the module.
  • Click the discolure triangle left of it
  • In Get, enter
return EndOfLine

OK. that works - sort of …

using the EOL computed property, the msgbox only works if I use App.EOL

EOL by itself still throws the error

I was adding the Method directly under the App.

Now I moved the Method into a Module and it works as required.

Thank You all for the pointers and guidance.