Wrox Programmer Forums
|
Visual Basic 2008 Essentials If you are new to Visual Basic programming with version 2008, this is the place to start your questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2008 Essentials section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 22nd, 2009, 01:57 PM
Authorized User
 
Join Date: Jun 2008
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Default Using Streamwriter appendtext

I am trying to write to a text file and just add to the end of the file. According to the vb 2008 programers reference book I can use streamwriter appendtext. However appendtext is not recognized. The error says its not declared. Here is some code:

Dim stream_writer As StreamWriter
stream_writer = AppendText(txtFileName.Text)
stream_writer.WriteLine(txtText.Text)
stream_writer.Close()

or using the code straight from the book:

Dim filename as string ="test.txt"
using sw as streamwriter= appendtext(filename)
sw.write(txtdata.text)
sw.close()
end using

Both result in an error saying appendtext not declared. I also tried createtext, opentext, and exist and none of them are recognized.

I have included at in my code: imports system.io do I need soemthing else?

Any Ideas?

 
Old June 22nd, 2009, 03:54 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Google is your friend.

http://msdn.microsoft.com/en-us/libr...ppendtext.aspx
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
 
Old June 22nd, 2009, 04:08 PM
Authorized User
 
Join Date: Jun 2008
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks for your help. However I discovered that my code was written just fine I just needed to include along with imports system.io

imports system.io.file

once I included this my code worked great.
 
Old July 10th, 2009, 07:14 PM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 244
Thanks: 3
Thanked 4 Times in 4 Posts
Default

Quote:
Originally Posted by gbianchi View Post
Google is your friend.
If google was so helpful there would be no point in this forum, also if google is the most widely used and promoted web search engine in the world don't you think that we would of already searched it? and just maybe we couldn't quite find what we wanted? because funnily enough google doesn't answer questions it merely produces web pages that contains what we wanted to search for NOT an answer!
So in short it is no use what so ever telling us to search google!
Also stating google is your friend then referencing to microsofts msdn is as about as intuative as saying to get to a foreign country go on bmiBaby but look here at ba flights!
MSDN is the friend NOT google
__________________
Apocolypse2005, I'm a programmer - of sorts.





Similar Threads
Thread Thread Starter Forum Replies Last Post
StreamWriter problem cheh Visual Basic 2008 Essentials 1 August 26th, 2008 03:18 AM
FileStream vs StreamWriter Makolyte C# 2005 0 June 22nd, 2007 01:22 PM
How To Use StreamWriter Slago VS.NET 2002/2003 7 April 4th, 2006 03:32 PM
What object is streamwriter located under? kenn_rosie ASP.NET 1.0 and 1.1 Basics 0 February 21st, 2006 08:10 PM
Problem using AppendText with Tab pages sis C# 3 February 16th, 2004 05:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.