|
-
Jun 23rd, 2001, 07:16 PM
#1
Thread Starter
Lively Member
Loading and Saving text..
I have asked this before.. and I had it in a text file.. but it was like 3 months ago and I reformatted, but anyways... How would I load and save text from a common dialog named cd ... the text box is text 1 and it is set to multiline.. I am making sorta a text editor... but its for quake and opens and edits .cfg files.. can anyone help ?
-
Jun 23rd, 2001, 07:29 PM
#2
Fanatic Member
A easy way to load the file would be as follows in this case i used a richtextbox1 instead of a textbox.
cd.Filter = "CFG Files (*.CFG)|*.CFG|All Files (*.*)|*.*"
cd.ShowOpen
RichTextBox1.LoadFile (CommonDialog1.FileName)
and to save:
cd.Filter = "CFG Files (*.CFG)|*.CFG|All Files (*.*)|*.*"
cd.ShowSave
RichTextBox1.SaveFile (CommonDialog1.FileName)
-
Jun 23rd, 2001, 07:45 PM
#3
Thread Starter
Lively Member
I cant use richtextbox, it says that it doesnt have a liscense..
-
Jun 23rd, 2001, 07:56 PM
#4
Member
okay so your not using richy... then heres the code for a regular text box...
'to load the text...
commondialog1.filter = "CFG Files (*.cfg) | *.cfg"
commondialog1.dialogtitle = "open a cfg file.."
commondialog1.showopen
open commondialog1.filename for input as #1
text1.text = Input(LOF(1),1)
close #1
'to save the text
commondialog1.filter = "CFG Files (*.cfg) | *.cfg"
commondialog1.dialogtitle = "save a cfg file.."
commondialog1.showsave
open commondialog1.filename for output as #1
print #1, text1.text
close #1
there you go!
my first post
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|