VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and sav

by Anthony Staunton (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Tue 8th February 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and save As done before so I wrote this code to

API Declarations


'cdialog = Common Dialog
'TextBox = RichTextBox
'Main = Form 1 or Mian Form

Main.Caption = "Untitled"

Rate File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and sav



If Error Then err
cdialog.Filter = "Text (*.txt)|*.txt|" ' you can add others here
Open cdialog.FileName For Output As #1
Print #1, TextBox
Close #1
err:
End Sub

Sub Open_Click()
cdialog.Filter = "Text (*.txt)|*.txt|"
Main.Caption = cdialog.Filename
Open cdilaog.FileName As #1
Print TextBox, #1
Close #1
End Sub

Sub Save_Click()
cdialog.Filename= Main.Caption
If cdialog.FileName = "Untitled"  Then SavaAs_Click
Else:
Open cdialog.Filename For Output As #1
Print #1, TextBox
Close #1
End Sub

Download this snippet    Add to My Saved Code

File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and sav Comments

No comments have been posted about File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and sav. Why not be the first to post a comment about File save, Save As and Open using Common Dialog ( I have only ever seen people do File Open and sav.

Post your comment

Subject:
Message:
0/1000 characters