Open a folder item from a listbox

Hello all.

Running Xojo 2023R4, on a mac running Sonoma 14.5.

I need a little help with an issue I am having. After going through the folder entry in the language reference, I am either missing something, or am trying to do something that isn’t possible (I doubt the latter).

I have a listbox with a series of entries with the Native Path to certain files.

I wish to take the information in the cell and put it into a folderitem variable, but nothing I do seems to work.

I have verified the full path and that it includes the file name.

Errors like “this is a string not a folder item”, “expected folder item but got int32”, etc are stymying my efforts.

Any idea as to what I am doing wrong?

Regards

What is the code that you have tried?

Unless you are showing the paths to the user for some reason, you can store the FolderItem as a Tag which will make it easier to pass around.

Have you tried:

var f as new FolderItem(Listbox1.CellTextAt(0,0))

You could also assign it to an existing folderitem via:

var f as FolderItem
f = New FolderItem(Listbox1.CellTextAt(0,0))

Edit: Silly me, CellTextAt returns a string on Desktop, so no .StringValue is needed. On Web it returns a variant.

You can create a simple sample project that shows your problem, zip it, and upload to the forum. Someone will review and give you better information.

1 Like

You do not say how you get the native paths…

FolderItem.NativePath

It is not said there too.

But it is said the NativePath is READ ONLY. So, according to that, how are-you building a FolderItem ?

Alberto advice is (as usual) full of good sense…

Oh boy, do I feel like a chimp.
I forgot the NEW.

Thanks for the catch.

I’d give you a star… if there was one…

Thank you Christian!