Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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.
It's not impossible, it's Inevitable.
Posted

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.

  • Leaders
Posted

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. :)

Iceplug, USN

One of my coworkers thinks that I believe that drawing bullets is the most efficient way of drawing bullets. Whatever!!! :-(

  • *Experts*
Posted
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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...