Results 1 to 9 of 9

Thread: Open File Method

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Soweto
    Posts
    3

    Question Open File Method

    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
    Nzenze

  2. #2
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    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.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Soweto
    Posts
    3

    Lightbulb Did use the Common Dialog Control

    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 ?
    Nzenze

  4. #4
    PowerPoster
    Join Date
    Nov 2001
    Location
    Trying to reach and stay in the cloud
    Posts
    2,089

    hi

    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.
    Attached Files Attached Files

  5. #5
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

  6. #6
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    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.
    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  7. #7
    Hyperactive Member
    Join Date
    Jul 2000
    Location
    Halifax,UK
    Posts
    274
    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
    VB6 VS2005

  8. #8
    Bouncy Member darre1's Avatar
    Join Date
    May 2001
    Location
    Peterborough, UK
    Posts
    3,828
    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!


    Confucious say, "Man standing naked in biscuit barrel not necessarily ****ing crackers."

    Don't forget to format your code in your posts

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2002
    Location
    Soweto
    Posts
    3
    Thanx guys, My problems are solved now
    Nzenze

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width