Results 1 to 2 of 2

Thread: Commondialog

  1. #1

    Thread Starter
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330

    Post

    How can you use the commondialog control to open a text file into a textbox in your app?


    ------------------


  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744

    Post

    Try this:


    Code:
    Dim strPath As String
    Dim iFFN As Integer
    Dim strBuffer As String
    
    On Error Resume Next
    
    With CommonDialog1
       .ShowOpen
       If Err.Number = cdlCancel Then Exit Sub
       strPath = .FileName  
    End With
    
    iFFN = FreeFile
    Open strPath For Input As iFFN
    strBuffer = Space(LOF(iFFN))
    strBuffer = Input(LOF(iFFN), #iFFN)
    Close #iFFN
    
    Text1.Text = strBuffer

    Regards,

    ------------------

    Serge

    Software Developer
    Serge_Dymkov@vertexinc.com
    Access8484@aol.com
    ICQ#: 51055819


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