Results 1 to 3 of 3

Thread: Help......

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    21

    Post

    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
    End If
    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


    the code is working perfectly .But can u explain it from step

    iffn = freefile.

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

    Post

    Sure.

    1. ShowOpen method of the CommonDialog control will open a dialog to select a file to open.

    2. Then, you check the Error number (cdlCancel means that the user clicked cancel on the CommonDialog)

    3. Memorize the path the user selected using FileName property.

    4. Find out the available file number (using FreeFile function)

    5. Open the selected file for Input (Read mode).

    6. Prepare the strBuffer variable to have the same length as the file (using LOF(iFFN))

    7. Read the file into strBuffer variable (using Input function)

    8. Assign the new text from strBuffer to the Textbox (Text1)


    Regards,

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

    Serge

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



    [This message has been edited by Serge (edited 11-11-1999).]

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 1999
    Posts
    21

    Post

    thanx Serge.It is clear now.

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