Problems with nt = Boolean.ToString(tbln)

desktop & current version

nt is string. tbln and QzTmpBool() are boolean.
I am getting this analyzer error I don’t understand.

Static reference to extension method: call this on a value of type Boolean.
nt = Boolean.ToString(tbln)

I tried previously
nt = Boolean.ToString(QzTmpBool(i))

What is wrong with my code?

I also tried and realized it probably wouldn’t work when the error showed up.
temp() is string

temp = string.fromarray(Boolean.ToString(QzTmpBool))

How about tbln.ToString?

(Boolean.ToString is not a class/shared method. You have to use it on a Boolean variable)

When I looked at the LR before, I expected to find Boolean,ToString
Var tbln as Boolean

It’s tbln.ToString

As always the LR is not idiot proof.

As I said: You need to distinguish between in this case methods and shared methods.
You can see that ToString is a normal method, while FromString is a shared method, which means it belongs to the class (or in this case data type), not to an instance/variable of it.

So it is
Var b as Boolean = Boolean.FromString(someString)
Var s As String = someBoolean.ToString.

This is valid through all the documentation.
If in doubt, check the examples which are normally shown when you click a method.

Thank you. I hadn’t understood the notation differences. And they are separated just like that in the LR

You’re welcome! Glad I could help to clarify it.

Forum for Xojo Programming Language and IDE. Copyright © 2021 Xojo, Inc.