Open and Save text

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
6,544
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Feb 20, 2009

How to make an program to open and save text in visual basic 6.

Code for the "Open" button:

Private Sub Command1_Click()
Me.CommonDialog1.Filter = "TextFiles (*.txt) | *.txt"
CommonDialog1.ShowOpen
Open CommonDialog1.FileName For Input As #1
Do Until EOF(1)
Input #1, contentfile
Text1 = Text1 & contentfile & vbCrLf
Loop
Close #1
End Sub

Code for the "Save" button:

Private Sub Command2_Click()
Me.CommonDialog1.Filter = "TextFiles (*.txt) | *.txt"
CommonDialog1.ShowSave
Open CommonDialog1.FileName For Output As #1
Print #1, Text1.Text
Close #1
End Sub

Enjoy!

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:
see all

All Comments (16)

Sign In or Sign Up now to post a comment!
  • I saved it right but for some reason I clicked it from my Desktop and it opened it in Notepad.

  • 2:51 WTF?

  • @l33tharg i dont really remember i said that 4 months ago

  • @zhir96 UH WHAT DID YOU JUST SAY?

  • VB 2008 Express edition not this VB 6

  • do you know how to make it save as .bin

  • run time error

  • i dont got the microsoft common dialog thing pls help

  • PERFECT!

  • Cant save =.=

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more