Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,
I'm chasing some help with opening files in my program. To open a data file I would normally use OpenFileDialog() and FileStream() which works great but...
I am trying to load some metastock data files but they are indexed by a file called master.dat. Master.dat is in an old format which I have parsed out and it gives an index of what the other files (F*.dat) represent in the directory. I can then go and open the correct F*.dat and retrieve the O,H,L,C data. But this is a two step process to get to where I want.
Example... open the directory the first time->
F1.dat
F2.dat
.
.
F50.dat
Master.dat
- I have to open Master.dat first to find out which F*.dat I'm looking for. The way I parsed out Master.dat looks something like this (not necessarily in alphabetical order.

Filename, Ticker, Long Name, First Data, Last Data
F1.dat, MSFT, Microsoft, 24/9/1999, 27/9/2010
F2.dat, CAM, Cameron Ent, 1/1/2005, 27/9/2010
.
.
F50.dat, APPL, Apple Comp, 24/9/1999, 27/9/2010

I then go and open the corresponding F*.dat file to get the data I want.

What I'd like to do is have the OpenFileDialog automatically open the Master.dat file and then list the contents shown above where I'd normally see the files, I can then directly open the stock file I want. I've sorted out the indexing code I just need someway of opening a directory and the master.dat loading automatically to show the index, not the actual file names.
Thanks in advance
Flatstrap
Posted
Comments
Toli Cuturicu 8-Oct-10 14:29pm    
Don't post fake answers again! This time I only deleted them.

1 solution

I do not think that you can get the OpenFileDialog to do that.

What you can do is create your own dialog, mimic the appearance of OFD if you want, probably containing a ListBox or ListView that would display the contents of Master.dat.

Then handle the doubleclick event to load the F*.dat file that was clicked.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900