Results 1 to 4 of 4

Thread: File Associations?

  1. #1
    Guest

    Question

    I asked a question about file associations quite a while ago, but I didnt really get the help that I needed,
    I know how to associate my app with a file type,
    but how do I open the file in my app?

    say I associated *.txt files with my app, how would I open the contents of the text file in a text box in my app?

    Thanks,
    Dennis Wrenn

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    When the file is launched using your App the Path and File name of the File is passed to your application. Use the "Command" function to retrieve this command line and use it to open the File and display it in your Textbox, i.e.
    Code:
    Private Sub Form_Load()
        Dim iFile As Integer
        Dim sFile As String
        
        iFile = FreeFile
        Open Command For Input As iFile
        sFile = Input(LOF(iFile), iFile)
        Close iFile
        Text1 = sFile
    End Sub

  3. #3
    Guest
    THANK YOU!!!

    ok, but what if they just open the app without opening a text file??

    would I do something like this?

    Code:
    Private Sub Form_Load()
        Dim iFile As Integer
        Dim sFile As String
        If Command <> "" Then
            iFile = FreeFile
            Open Command For Input As iFile
                sFile = Input(LOF(iFile), iFile)
            Close iFile
            Text1 = sFile
        End If
    End Sub
    ???
    Thanks Again,
    Dennis Wrenn

  4. #4
    Guest
    What extensions are you having your program open with?

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