Hi guys! I would like to ask you a question about on how to save data on a text file using visual basic. I have a hard time getting the right code for this function. Does anybody of you know a simple code that you can share to me. I appreciate any answers that you will share to me...

Thank you and more power to us programmers!!!

:)

Try using CommonDialogControl.

commented: He is talking about writing data to txt file not saving a txt file -1

Try this code

Private Sub Command1_Click()
Open App.Path + "\myfiles.txt" For Output As #1
Write #1, "Hello"
Close 1
End Sub

the code will on click of Command1 button, open the file myfiles.txt if it does not exist it will create one. For More information Google "Sequential files".

commented: do you understand the difference between the two ? -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.