Another question allowed?
if I have a parent folder named via parent=dlg.ShowModal() how can I add a different textfield to the name of that folder?
For example… I have a job number entered in a previous field and I want to marry that to the name entered via dlg.SuggestedFileName=(“Name”)
I know I can do it by altering the SuggestedFileName by adding the textfield to it but I don’t want to as I need to keep the fields separate as I reference them individually later.
Justin, not quite sure I understand your question, but if you are asking how to insert a variable as a suggested filename, you could try the code below:
dim name As String = Window1.TextField2.text
dlg.SuggestedFileName = (name)
Simply replace Window1.TextField2 with the name of the window and textfield which contains the string you wish the filename to be.
If you are asking how to append another textfield’s content onto the end of the filename, then try this:
dim name As String = "Name" + Window1.TextField2.text
dlg.SuggestedFileName = (name)
Hope that helps, if not, just reply back here again
Hmmmm… I don’t think that is it as I am not wanting … this is what I have.
Dim dlg as New SaveAsDialog
dim parent as FolderItem
dim fname as String
dlg.InitialDirectory=SpecialFolder.Mount
dlg.SuggestedFileName= (“NAME”)
dlg.promptText=“Please enter the Project Name”
parent=dlg.ShowModal()
parent.CreateAsFolder
I am wanting to append parent with a TextField1 entry before the parent folder is created. I know I can do it by altering the SuggestedFileName by adding the textfield to it but I don’t want to as I need to keep the fields separate as I reference them individually later.
Justin,
If you want to append a textfield’s name onto the end of the actual folder name, you could try this:
Dim dlg as New SaveAsDialog
dim parent as FolderItem
dim fname as String
dlg.InitialDirectory=SpecialFolder.ApplicationData.Child("myDataFolder")
dlg.SuggestedFileName= ("NAME")
dlg.promptText="Please enter the Project Name"
parent=dlg.ShowModal()
parent.CreateAsFolder
parent.name = parent.name + TextField1.text
This will allow the user to define both the name and the path of the folder. The folder then gets created, and the last line of code will then rename the folder, (appending the TextField’s content onto the end), after it has been created.
Obviously you need to replace the InitialDirectory with your desired path.
There are probably other more efficient ways of doing this, and I am extremely tired, but I quickly tried this for you and it works
Thank you! That was it! Again, I am over thinking the problem.