I am given a project to store stuff in files and retrieve them. So I need help with the open file method. I want the users to be able to open a specific file in the same way they open files in windows. SO PLEASE HELP ME
Printable View
I am given a project to store stuff in files and retrieve them. So I need help with the open file method. I want the users to be able to open a specific file in the same way they open files in windows. SO PLEASE HELP ME
use the common dialog control. You will need to set it in your project components. Its dead easy to use though and looks just like other windows open/save dialogues etc.
I did use the common Dialog Control but when I click open the file does not open. Do you know what code I can use to open the chosen file ?
Heres an example
Clicking on the name of the file will jot only display the file but also open it in its "default" windows program.
This thread may help you.
http://161.58.186.97/showthread.php?s=&threadid=135689
the common dialog control is just an interface that allows the user to specify a directory, filename etc and a few other things, but it doesn't actually DO anything with the file.
What it does with the file after the user has clicked on Open, is up to you, and your code.
are you wanting to open the file so that you can edit the contents in VB..if so you need the open method. This does not open the file with the associated app, but gives you direct access to the bytes of the file..
2 examples are
open myfile for Input as #1 'input line by line (doesn't work on binary files)
open myfile for Binary as #1 'binary file input
there is more to this command, see MSDN for more
if you want an easier file i/o routine, try using the FileSystemObject.
you will have to set a Project Reference to "Microsoft Scripting Runtime" but it's i good place to start if you've never done file I/O before.
I did!
:D
Thanx guys, My problems are solved now