Class and its scope

Alas…Compiler reports: You cannot assign a non-value type to a value…

Then you defined it wrong. Either that, or you have another method or property named newCCD that is closer in scope.

What does your property definition in the module look like?

Hello Tim,

I searched for a double declaration or something but not found.

It is declared in a module Globals. Name: CDDClass, scope: Global
I’ve added about 12 properties (string/boolean).

In the window I declared a property ‘newCCC as CDDClass’
In the Open event of the main Window I put: newCDD = CDDClass, but results in compiler error You cannot assign a non-value type to a value.

I’m very sure that there is no other newCDD declaration somewhere, or Xojo omits a decent search…

Try - for both the definition and the instantiation - with YourModuleName.CDDClass instead of just CDDClass

If it then compiles, you indeed have another CDDClass defined that is closer in scope.

You should expect an error here. You cannot assign classes to variables or properties.

Instead you want to assign a class instance to your property (which is called newCCC, not newCDD):

newCCC = New CDDClass