|
-
Aug 11th, 2000, 09:50 PM
#1
Thread Starter
PowerPoster
Hi, can you help me with this code?
I want to load the contents of the file into a text box for editing by the user, but for some reason, the file doesn't show up in the text dialog. Heres what i've got:
Code:
Dim sFile
Dim sA
'Prompt user for filename
CD1.DialogTitle = "Secure-It!"
CD1.Flags = cdlOFNHideReadOnly
CD1.Filter = "HTML Files|*.htm;*.html|Text Files|*.txt|All files (*.*)|*.*"
CD1.CancelError = True
On Error Resume Next
CD1.ShowOpen
'Grab filename
sFile = CD1.FileName
If Err = 0 Then
On Error Resume Next
Open sFile For Random As #1
Print #1, sA
Close #1
End If
txtCode = sA
frmMain.Caption = "PageGen Unlimited - " & sFile
-
Aug 11th, 2000, 10:00 PM
#2
Try:
Code:
On Error Resume Next
Dim sFile
Dim sA
'Prompt user for filename
CD1.DialogTitle = "Secure-It!"
CD1.Flags = cdlOFNHideReadOnly
CD1.Filter = "HTML Files|*.htm;*.html|Text Files|*.txt|All files (*.*)|*.*"
CD1.CancelError = True
On Error Resume Next
CD1.ShowOpen
'Grab filename
sFile = CD1.FileName
If Err = 0 Then
Open sFile For Output As #1
Print #1, sA
Close #1
End If
txtCode = sA
frmMain.Caption = "PageGen Unlimited - " & sFile
-
Aug 12th, 2000, 09:30 AM
#3
Member
You made a small mistake
Hi use this code:
Dim sFile
Dim sA As String
'Prompt user for filename
CD1.DialogTitle = "Secure-It!"
CD1.Flags = cdlOFNHideReadOnly
CD1.Filter = "HTML Files|*.htm;*.html|Text Files|*.txt|All files (*.*)|*.*"
CD1.CancelError = True
On Error Resume Next
CD1.ShowOpen
'Grab filename
sFile = CD1.FileName
If Err = 0 Then
On Error Resume Next
Open sFile For Random As #1
Do Until EOF(#1)
Line Input #1, sA
txtCode.Text = txtCode.Text & vbcrlf & sA
Loop
Close #1
End If
frmMain.Caption = "PageGen Unlimited - " & sFile
'Hope this will do 
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
|