filename in txt field

I’m looking for sample code to use Windows Explorer to put a filename and path in a variable. I want so make a file reference.

Declare a globlal DialogBox of Type OCX and select this one : Microsoft Common Dialog, COMDLG32.OCX Then the following line of code should do the trick : DialogBox.DialogTitle := ‘Select your file’; DialogBox.InitDir := ‘C:\Temp\Very Boring Accounting Files’; DialogBox.Filter := ‘Text files|.txt|All files|,.*’; DialogBox.ShowOpen; FileName := BrowseDialog.FileName; tarek_demiati@ureach.com Edited by - Tarek Demiati on 2001 Feb 27 16:21:43

I found some sample code at www.mynavision.net. It also uses this ocx. Thanks for this quick answer

can someone give me where i can find this OCX Stéphane VABOIS

You can find this OCX on http://www.mynavision.net on download section Title are Get/Set filename using COMDLG32.OCX Edited by - ako_ebsi on 2001 Mar 14 12:49:32

You just have to be careful with the different versions of the COMDLG32.OCX. I found that some programs install a version that requires a license to run. As well, there appears to be issues when you design for one OS (like Win 98) and then it is run with another OS (like NT). Has anyone ever resolved this type of problem with the COMDLG32.OCX? Regards, Floyd Chan, NCSD WSSD FutureLink Canada Corp.

quote:


[You just have to be careful with the different versions of the COMDLG32.OCX.[…] As well, there appears to be issues when you design for one OS (like Win 98) and then it is run with another OS (like NT).


I’m afraid, I have to completely disagree with your concerns. I have used this OCX and the Navision objects (the same ones I had posted to http://www.mynavision.net dowload area) in many different Installations including Win98 and also NT. According to my experience there are lot’s of NT clients where COMDLG32.OCX is not installed. Installing and registering it as I mentioned in the Readme.TXT (which comes with the downloaded package), I never encountered any difficulties. However there is a general rule that if you want to compile a FOB which contains calls to an OCX you need to have a license to this OCX. I am unable to tell whether or not a license is necessary for the COMDLG or under which circumstances the license is being installed. As I own the MS Office Developer Tools, as well as the MSDN Library I have access to almost every Microsoft OCX. However, as long as you don’t modify my original FOB, you don’t have to recompile and therefore it wouldn’t matter whether or not you own a license. If you have to modify (enhance?) my FOB, you might send it to me and I’ll compile it for you providing you give me your permission to put the enhanced FOB once again in the download area for public free use. Marcus Fabian phone: +41 79 4397872 m.fabian@thenet.ch

Floyd, No need to worry here. I have used the Common Dialog in many situations, not only for selecting a filename but also for selecting directories, and the same Navision objects ran flawless on workstations with Windows 95, 98, NT and now even 2000. You do need a Developers License, however to compile the objects. Such a license is part of the Visual Studio series from Microsoft, but probably also comes with the VBA module of Office. John

One way of doing this without having to declare OCXes is this: Global variables: recCompany Subtype company (I use the company because it has a BLOB-field) FilePathName Text 250 Use the FilePathName as source expression to a textBox with the AssistEdit property set to Yes In the OnAssistEdit trigger for this textbox, put the following code: FilePathName := RecCompany.Picture.IMPORT(’.’,TRUE); FilePathName := FilePathName; That should result in that the complete path now is in the FilePathName Field.