Results 1 to 2 of 2

Thread: Browsing

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2006
    Posts
    39

    Question Browsing

    I'm trying to create a button that is able to browse over the files in the entire computer so you are able to save a text file with the score you got (in the game I have made).

    I was giving the following code to put into a button,

    VB Code:
    1. With CommonDialog1  'open a with statement as there is a lot of code
    2.      .DialogTitle = "Save"  'sets the dialog title
    3.      .InitDir = "C:\"  'sets the initial directory
    4.      .Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*"  'sets the file
    5.      'types
    6.  
    7.      .ShowSave  'show the dialog
    8. End With

    But I cannot get it to work. When I click on the save button it says for the line,

    DialogTitle = "Save" 'sets the dialog title

    object required. Since this code is very new to me I dont know what object is missing, could someone help?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Browsing

    The object is CommonDialog1, which should be an object on your form (just as you would add a text box).

    As you have posted this in Office Development, I assume that you using VBA (the VB editor in an Office app) rather than 'proper' VB. If this is the case, I'm afraid you wont have the CommonDialog control - but there should be alternative methods in this forum, which you can find using a search.

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