How to do SelectFolderDialog and Select Case

Try as I might I couldn’t find the right combination for SelectFolderDialog and Select Case.
The analyzer didn’t like any of my combinations.
In MessageDialog the example is Select Case but that apparently doesn’t work with SelectFolderDialog
I reference SelectFolderDialog and MessageDialog
Am I missing something?

Exactly what are you trying to do?
Post the code you wrote and add notes of what your expectations were
and we will see if you can’t help you fix it

I’ve identified the problems lines as

//Not a Property of SelectFolderDialog

[code]Dim fPf As FolderItem
Dim dCPf As SelectFolderDialog
dCPf = New SelectFolderDialog
Dim b As SelectFolderDialog.ActionButton//Not a Property of SelectFolderDialog
dCPf.ActionButtonCaption = “Select”
dCPf.PromptText = “You can Copy a Set of Preferences” + EndOfLine + “To Your Collection” + EndOfLine + _
“Select the Name of the other Collection” + EndOfLine + _
“PRESS Select to Copy A Set of Preferences” + EndOfLine + _
“PRESS Cancel to Start a New Set of Preferences or just Cancel.”

dCPf.InitialDirectory= IniHerd.IniFolder
b = dCPf.ShowModal

Select Case b
Case dCPf.ActionButton//Not a Property of SelectFolderDialog
//Does stuff
Case dCPf.CancelButton//Not a property of SelectFolderDialog
End Select[/code]
For some reason my Preview isn’t showing the usual indentation of XOJO. Sorry

[code]dCPf.InitialDirectory= IniHerd.IniFolder
b = dCPf.ShowModal

if b = nil then
//do what cancel would have done
else
//you have a folderitem… now you can use it…

end if[/code]

Its not the same as a customised messagebox

Jeff got there a few seconds before me :slight_smile:

refer to the Lang Ref and there is a great example which shows what Jeff is talking about

and here “B” is defined as a folderitem

Sorry I didn’t include my conclusion. Only If statements work here.
I was just hoping I didn’t have to use “If” and I didn’t waste my time trying to fit a round peg into a square hole.
My question was just about Select Case and how to do it with SelectFolderDialog. Is it a round hole for me?

what would you do in a SELECT CASE statement?

The result is FOLDERITEM is nil if the user canceled
and NOT Nil if they selected a folder…

Only TWO choices…

Dim dlg As New SelectFolderDialog
dlg.ActionButtonCaption = "Select"
dlg.Title = "Title Property"
dlg.PromptText = "Prompt Text"
dlg.InitialDirectory = SpecialFolder.Documents

Dim f As FolderItem
f = dlg.ShowModal
If f <> Nil Then
  // Use the folderitem here
Else
  // User cancelled
End If

ASSUMING you refered to the LangRef you would have seen the above example on how to use SelectFolderDialog, as well as the properties and notes

I guess you could do

select case F
case nil 
  // Use the folderitem here
case Else
  // User cancelled
End Select

but why (assuming that even works)

Thank you. Case Nil wasn’t in my head. The example in messagedialog had used b.actiionbutton (I think) . I’ll try it when I got back

And messageDialog and SelectFolder do not work the same, which is what Jeff and I tried valiantly to point out…
Of course it is your choice to choose how you wish to do it, and within your right to ignore the advice provided to you.

good luck… I will be leaving this conversation now, as I have provided what I can…

Thank you for indulging me. I learned about Select and Case and you are correct in that it is not a good choice for SelectFolderDialog

[quote]select case F
case nil
// Use the folderitem here
case Else
// User cancelled
End Select[/quote]