English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to make a text editor for fun in Visual Basic but how do i save the file with the text in it after i create it?
I mean i have a variable text. How do i save this variable into a file like
Text.txt???

2007-03-03 06:03:40 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

How to instantiate a Save-As dialog: http://www.developerfusion.co.uk/show/11/3/

You can then get the arguments returned from the dialog, such as the filename, and use that in your filestream output. One way is like so:

Set fileSystem = CreateObject( "Scripting.FileSystemObject" )
Set file = fileSystem.createtextfile( [filename and path from the dialog] )
file.write [text editor contents]

2007-03-03 06:08:36 · answer #1 · answered by Rex M 6 · 0 0

After getting the filename using the save as dialog box,
Use FileSystemObject for writing into the files. I have given the sample code:
Set FSO = CreateObject("Scripting.FileSystemObject")
Set F = FSO.createtextfile(App.Path & filename)
F.write txtdoc.text

2007-03-03 14:28:45 · answer #2 · answered by Baskar Mookkan 2 · 0 1

it will be good if everyone who posts visual basic questions.. tells us if it's VB6 or VB.NET so i don't have to guess ;-)

2007-03-03 18:03:48 · answer #3 · answered by Zlavzilla 3 · 0 1

fedest.com, questions and answers