Opening a Folder - Common Dialog (Simple Solution)

David_Cox
Member Posts: 509
I searched the forum for a solution to open a folder from a path in a database field.
There was a couple of answer's saying it was not possible or messy.
If anyone is interested here is a workaround, using a field called "Document folder".
txt:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',1,'',0);
Excel:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',2,'',0);
Word:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',1,'',0);
All Files:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',4,'All Files (*.*)|*.*|All Files (*.*)|*.*',0);
What happens is the commom dialog thinks there is a filename because of the added period in the +'.', and nothing comes up in the Filename on the Windows Dialog screen
C:\Temp\.
No special Automation required, it seems to work ok here, just thought I would share this!
David
There was a couple of answer's saying it was not possible or messy.
If anyone is interested here is a workaround, using a field called "Document folder".
txt:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',1,'',0);
Excel:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',2,'',0);
Word:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',1,'',0);
All Files:
CommonDialogMgmt.OpenFile(Name,"Document Folder"+'.',4,'All Files (*.*)|*.*|All Files (*.*)|*.*',0);
What happens is the commom dialog thinks there is a filename because of the added period in the +'.', and nothing comes up in the Filename on the Windows Dialog screen
C:\Temp\.
No special Automation required, it seems to work ok here, just thought I would share this!
David
Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
0
Comments
-
David Cox wrote:I searched the forum for a solution to open a folder from a path in a database field.
There was a couple of answer's saying it was not possible or messy.
Have a look at these two topics:
- Select a folder in Navision
- Get a Folder (Not Reg. new DLLs)Timo Lässer
Microsoft Dynamics NAV Developer since 1997
MSDynamics.de - German Microsoft Dynamics Community - member of [clip]0 -
Timo Lässer wrote:David Cox wrote:I searched the forum for a solution to open a folder from a path in a database field.
There was a couple of answer's saying it was not possible or messy.
Have a look at these two topics:
- Select a folder in Navision
- Get a Folder (Not Reg. new DLLs)
Hi Timo
I had already read all the the first link and you concluded that is not possible, as in the last reply of that post.
But reading it again, you was talking about the position in the tree. #-o
The Second link which I did not get up in my search, has a couple of functions to add, with a few lines of code. :!: Messy
My work around requires you just to add + '.' to the file path, and I know that any non modification solution would be best for me and my clients, with no additional cost or upgrade issues.
Any Developer reading this on a budgeted fixed price project, would in most cases use the + '.', unless they had over quoted and had a lot of time to use up, which tends not to be the case, add a field that looks up a folder, would not be quoted to much in the analysis. :shock:
I would not have posted this if I thought that there was a better easy solution, it was posted as when searching I could not find a simple solution, and a small bit of knowledge shared might save someone else some time. =D>
If you can come up with a solution in less that 4 letters, please let me know :-k
I have renamed the thread, adding Simple Solution!
Regards
David
K.I.S.S ](*,)Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com0 -
[Topic moved from Navision forum to Navision Tips & Tricks forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Check this:
OpenFolder(WindowTitle : Text[50];HighestFolder : Text[500]) : Text[1024]
IF ISCLEAR(ShellControl) THEN
CREATE(ShellControl);
Folder := ShellControl.BrowseForFolder(0,WindowTitle,0,HighestFolder);
IF NOT ISCLEAR(Folder) THEN
FolderText := Folder.Items().Item.Path;
CLEAR(ShellControl);
EXIT(FolderText);
the variables required are:
Var Name DataType Subtype Length
No WindowTitle Text 50
No HighestFolder Text 500
Name DataType Subtype Length
ShellControl Automation 'Microsoft Shell Controls And Automation'.Shell
Folder Automation 'Microsoft Shell Controls And Automation'.Folder3
FolderText Text 10240 -
Hello,
I just found this solution (arcull code). Taht's great, but when I choose desktop I get the message for C/AL programmers that autmation variable has not been instantiated.
I know that my client first click Desktop ikon.0 -
Hmm... maybe it worked before, but with win 7 and 2009 R2 classic the dot trick does not work.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions