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!
I saved it right but for some reason I clicked it from my Desktop and it opened it in Notepad.
SonitrolCP 4 months ago
2:51 WTF?
MultiVideogamelover 6 months ago
@l33tharg i dont really remember i said that 4 months ago
zhir96 1 year ago
@zhir96 UH WHAT DID YOU JUST SAY?
l33tharg 1 year ago
VB 2008 Express edition not this VB 6
zhir96 1 year ago
do you know how to make it save as .bin
PR0GAM3ST3R 1 year ago
run time error
TheErgic 1 year ago
i dont got the microsoft common dialog thing pls help
TheErgic 1 year ago
PERFECT!
VB6andCMD 1 year ago
Cant save =.=
0Wolf0Braduz00 2 years ago