Folderitem.child

Am wondering why this code shows f2 folderitem is blank.

Probably a silly mistake on my part.

Thanks for Any Answer.
///-----------------------------
Dim f As FolderItem
Dim f2 as folderitem
Dim dlg As OpenDialog

// create a new openDialog
dlg = New OpenDialog

// display the dialog
f = dlg.ShowModal

if f <> nil then
f2 = f.child(“test”)

msgbox(f2.name)

end if
//---------------------------------
Sorry Brain not working…

[quote=481797:@Ian Cartwright]Am wondering why this code shows f2 folderitem is blank.

Probably a silly mistake on my part.

Thanks for Any Answer.[/quote]
What code? :slight_smile:

Works if you change

f = dlg.showmodal to f= selectfolder

wortks with folder but not filename…?

OpenDialog is for opening a file, you can’t select a folder and therefore it can’t have children.
To select a folder you need SelectFolderDialog.

Try this:

if f <> nil then
  f2 = f.child("test")

  if f2.Exists = true then
    msgbox(f2.name )
  else
    msgbox("f2 doesn't exist.")
  end

end if