|
-
Nov 10th, 1999, 11:49 PM
#1
Thread Starter
Junior Member
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.
-
Nov 11th, 1999, 01:45 AM
#2
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
[email protected]
[email protected]
ICQ#: 51055819
[This message has been edited by Serge (edited 11-11-1999).]
-
Nov 12th, 1999, 02:49 AM
#3
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|