DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Visual Basic 4 / 5 / 6 (http://www.daniweb.com/forums/forum4.html)
-   -   need help... (http://www.daniweb.com/forums/thread86178.html)

coco86 Aug 14th, 2007 1:19 am
need help...
 
hi.. I have a problem on opening 2 file ... as below is my code... I want to open 1 file let's say .Dat file and it will trigger the other .Hdr file. the only different is the extension name , 11U06P0434FN.dat and 11U06P0434FN.hdr .... anyone can help me .... please .

CommonDialog1.Filter = ".Dat"
CommonDialog1.InitDir = App.Path & "\BatchFile"
CommonDialog1.FileName = ""
CommonDialog1.ShowOpen

txtdata(0).Text = rtndirectory(Trim(CommonDialog1.FileTitle))
If Trim(CommonDialog1.FileName) = "" Then Exit Sub
DatFName = CommonDialog1.FileName

CommonDialog1.ShowOpen
txtdata(1).Text = rtndirectory(Trim(CommonDialog1.FileTitle))
HdrFName = CommonDialog1.FileName

End Sub

binoj_daniel Aug 14th, 2007 1:05 pm
Re: need help...
 
So if you mean that you don't get the option to open multiple type files, then you need to change your code slightly.

CommonDialog1.Filter = "Dat File (*.Dat)|Hdr File (*.Hdr)"

This will give you option to open both type of files

coco86 Aug 14th, 2007 9:33 pm
Re: need help...
 
thnx binoj_daniel..

binoj_daniel Aug 14th, 2007 10:05 pm
Re: need help...
 
Let me know if that worked?

binoj_daniel Aug 14th, 2007 10:06 pm
Re: need help...
 
you can also register on my site for more tech articles. click here to visit my site

QVeen72 Aug 15th, 2007 2:58 am
Re: need help...
 
Hi,

use ur code to open Dat file and then get the header file by just replacing last 3 chars:

DatFName = CommonDialog1.FileName
HdrFName = Replace(LCase(DatFName),".dat",".hdr")

Or

DatFName = CommonDialog1.FileName
HdrFName = Left(DatFName,Len(DatFName)-3) & "hdr"

Regards
Veena

coco86 Aug 15th, 2007 3:05 am
Re: need help...
 
thnx veena , it works .... i use the 2nd one u gave me.... thnx alot.....

coco86 Aug 15th, 2007 3:08 am
Re: need help...
 
thnx veena .... it works .... i use the 2nd one u gave me..... appreciate it....


All times are GMT -4. The time now is 10:29 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC