Link to home
Start Free TrialLog in
Avatar of enryo
enryo

asked on

txt file

how can i create a txt file with code in VB 5.0 ?
Avatar of Vbmaster
Vbmaster

Open filename For Output As #1
Print #1, Text
Print #1, Some more text
..
..
..
Close #1

Check ya helpfile on the Open statement
Hello there,
Example code

Create on your form 1 button with Caption "Create"
1 text box where the file name will be specificated
and another one where you will write the file's contents

and past the code below in your form

Private Sub Command1_Click()
    Open Text1.Text For Output As #1
    Print #1, Text2.Text
    Close #1
End Sub

That's all
Avatar of enryo

ASKER

the first time that i run my program i get this error "file not found" so how do i detect the error to create the file?
ASKER CERTIFIED SOLUTION
Avatar of kianwei
kianwei

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial