Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / September 2004

Tip: Looking for answers? Try searching our database.

save/open

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Newbie - 30 Sep 2004 23:35 GMT
I am trying to get the save/open dialog figured out.  I am able open the save
dialog but when I put in a file name (whatever.txt) and save the file does
save with the name but it is blank.  Below is what I have code so far.  

Dim phonestreamwriter As StreamWriter
Dim responsedialogresults As DialogResult
SaveFileDialog1.InitialDirectory = Application.StartupPath
responsedialogresults = SaveFileDialog1.ShowDialog
If responsedialogresults <> DialogResult.Cancel Then
phonestreamwriter = New StreamWriter(SaveFileDialog1.FileName)
End If
Ben Lucas - 30 Sep 2004 23:45 GMT
You open the StreamWriter which creates the file, but you also have to write
something to it.  For example, if you added the following line after you
create the StreamWriter:

phonestreamwriter.WriteLine("Hello, world")
phonestreamwriter.Flush()
phonestreamwriter.Close()

the underlying file would have the content "Hello, world" inside the file.

You have to define what is supposed to go into the file.  The save/open
dialog is only used to query the user for the file path.

Signature

Ben Lucas
Lead Developer
Solien Technology, Inc.
www.solien.com

> I am trying to get the save/open dialog figured out.  I am able open the save
> dialog but when I put in a file name (whatever.txt) and save the file does
[quoted text clipped - 7 lines]
> phonestreamwriter = New StreamWriter(SaveFileDialog1.FileName)
> End If
Newbie - 01 Oct 2004 00:01 GMT
If I have text in a rich text on a form how do I write that to the file

RichTextBox1.Text  = SaveFileDialog1.FileName????

> You open the StreamWriter which creates the file, but you also have to write
> something to it.  For example, if you added the following line after you
[quoted text clipped - 21 lines]
> > phonestreamwriter = New StreamWriter(SaveFileDialog1.FileName)
> > End If
Jeff Dillon - 01 Oct 2004 00:09 GMT
phonestreamwriter.WriteLine(RichTextBox1.Text)

> If I have text in a rich text on a form how do I write that to the file
>
[quoted text clipped - 25 lines]
> > > phonestreamwriter = New StreamWriter(SaveFileDialog1.FileName)
> > > End If

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.