Where do I put the As New Class

In my previous question I asked how I create a class with a class in it. Thanks to Rick A and others I now have a working class.
But when I try to use this class within severall controls I seem to lose the value of the class. I set the value of the class in the ListBox CellPressed methode:

Var NLFlower As New clsNLFlower
NLFlower =  lstNLFlowers.RowTagAt(row) 

// Var SellingNLFlower As New clsNLSold
SellingNLFlower.AddFlower(NLFlower)

But where do I put
Var SellingNLFlower As New clsNLSold
because as soon as I leave the CellPressed methode the value of SellingNLFlower class is nill.

I have tried to put the code in the Form Event Handlers - Open methode, but it keeps giving SellingNLFlowers as Nil in other controls methods.

Well it will do because its scope is only that method. You need to put that declaraion where it will be visible to more components of your app. Make it a property of the enclosing window or control.

Yes, I have done this, but somewhere I must have made a mistake.
I put

Var SellingNLFlower As  New clsNLSold 

in the Event Handlers-Open methode.
I have created a property of the class.

Scherm­afbeelding 2023-06-22 om 18.28.50

When I put a breakpoint before the Var line in the Open methode it doesn´t stop executing.

And so you create a variable that is local to the Open event handler. It dies when Open completes.

In Open, make it:

SellingNLFlower = New clsNLSold 

instead.

That was my problem. Indeed, now that you have ‘said’ it, it makes sense.
Now I am using an existing variable (property) and stating it has a class.

Thank you Tim.