Folderitem based class

Hello,
I’m trying to create a class based on (sub of) folderitem class, but I can’t figure out how to instantiate it.

If i use standard folderitem constructor it says it’s the wrong class, If I use “new” and then try to instantiate it from inside, I can’t figure out how.

Is it possibile?

thank you very much!


Enrico Rosso

I don’t think you can.

Probably best to create a class and then store the folderitem as a private property.

Why don’t you Extends the current one instead ?

Extends

Works fine for me.

Created a class, parent = FolderItem
Added a property nWhatever

Added 2 constructors, one which called super and initialised nWhatever
One that takes a folderitem as a parameter

All works fine
Here is the simple constructor.

here is how to treat the New statement like a folderitem:

And my testing…

dim f as FolderItem
f = specialfolder.documents

dim h as new MyFolderItem(f)
msgbox cstr(h.nwhatever)
msgbox h.NativePath
1 Like

Thank you all for your really fast answers.
Kevin: for sure that’s what i thought, less elegant but working for sure
Emile: Using extends wouldn’t be practical as I’d like to build a lot around this class.
Jeff: This is cool and you took the time to build a test for it! Thank you very much, I really appreciate your time and your clear explanation, I’m going to test it today!

Have you all a good day!

Your solution works like a charm. Thank you very much!!


Enrico