PureSc0pe Posted March 23, 2004 Posted March 23, 2004 I know I need to use StreamWriter, but how would I go about creating vb code to add and delete a whole line of text from a text document. You enter the text into a TextBox and Click the button to enter it. Quote It's not impossible, it's Inevitable.
Jay1b Posted March 23, 2004 Posted March 23, 2004 Use ReadLine, in a loop, have an if statement in the loop. If the current line <> specified line, then add to string. Then write out this string. So basically u break the txtfile down line by line then add the lines that are wanted to another string - which you output. Quote
Leaders Iceplug Posted March 23, 2004 Leaders Posted March 23, 2004 For adding the contents of a textbox to the end of a file, open the file for Append mode. For adding the text anywhere besides the end of the file, you'll need to do as Jay1b mentioned and Readline from the file into a string, and then Write the string into a new file. :) Quote Iceplug, USN One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(
PureSc0pe Posted March 24, 2004 Author Posted March 24, 2004 I am having trouble with this one...Can you start me off with some Code? I want to write to the end of the textfile. Quote It's not impossible, it's Inevitable.
*Experts* mutant Posted March 24, 2004 *Experts* Posted March 24, 2004 To open the file in append mode create a new StreamWriter object, and as a second argument pass in true which will tell the stream writer that you want to write to the end of the file. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.