VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Save Save As and Open dialogs ( sorry but some problems with first code I submitted)

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

Save Save As and Open dialogs ( sorry but some problems with first code I submitted)

API Declarations


Main.Caption = "Untitled"
cdiailog.FileName=Main.Caption
End Sub

Rate Save Save As and Open dialogs ( sorry but some problems with first code I submitted)



If Error then err
cdialog.Filter="Text (*.txt)|*.txt|"
cdialog.ShowSave
Open cdilaog.FileName For output As #1
Print #1, TextBox
Close #1
err:
End Sub

Private Sub Open()
If Error Then err
cdialog.Filter="Text (*.txt)|*.txt|"
cdialog.ShowOpen
Open cdilaog.Filename For Input As #1
Print TextBox, #1
Close #1
Main.Caption=cdialog.FileName
err:
End Sub

Private Sub Save()
If Error The Err
cdialog.Filter="Text (*.txt)|*.txt|" 'this is here to provide uniformity
If cdilaog.FileName="" Then Save_As ' if there is no filename this will send the program to Save As to ask for a file name or else it will carry on
Open cdilaog.Filename For Output As #1 ' This opens the file if it has a name then saves the contents of the textbox into it.
Print #1, TextBox
Close #1
err:
End Sub


Download this snippet    Add to My Saved Code

Save Save As and Open dialogs ( sorry but some problems with first code I submitted) Comments

No comments have been posted about Save Save As and Open dialogs ( sorry but some problems with first code I submitted). Why not be the first to post a comment about Save Save As and Open dialogs ( sorry but some problems with first code I submitted).

Post your comment

Subject:
Message:
0/1000 characters