Re: Comparing FolderItems

Marnaud <[email protected]> Fri, 18 May 2018 11:36:21 +0200
Newsgroups gmane.comp.lang.realbasic.user
Message-ID <[email protected]>
> Le 18 mai 2018 à 10:24 du matin, Jean-Luc Arnaud <jean-luc-E/[email protected]> a écrit:
> 
> Hi all,
> 
> I'm issuing something strange (at least for me).
> 
> I'm probably wrong in my code but don't understand why.
> 
> I'm trying to compare 2 FolderItems as follow:
> 
>        If MyFolder1=MyFolder2.Child(MyFolder1_Name) Then
>            // It's the folderitem I'm looking for
>        EndIf
> 
> where MyFolder1_Name is a string representing MyFolder1.Name, and of course, MyFolder1 exists and is located in MyFolder2.
> 
> This results always as False, even if the folderitems are the same (verified comparing their NativePath).
> So, it seems like I should compare NativePaths instead of FolderItems themselves. But I would like to understand...
> 
> TIA for any information.

Hello Jean-Luc,

You're comparing two objects representing folderitems, not their paths. Both objects have their own location in memory, thus they aren't the same object.