Click here to Skip to main content
15,917,455 members
Home / Discussions / C#
   

C#

 
GeneralRe: Creating Setup File Pin
Narendra Reddy Vajrala6-Apr-09 23:08
Narendra Reddy Vajrala6-Apr-09 23:08 
Questionset focus to Process using c# in API/Code [modified] Pin
lostboy6-Apr-09 5:59
lostboy6-Apr-09 5:59 
AnswerRe: set focus to Process using c# in API/Code Pin
Henry Minute6-Apr-09 12:14
Henry Minute6-Apr-09 12:14 
QuestionRTP developement in .net Pin
Saurabh90906-Apr-09 5:45
Saurabh90906-Apr-09 5:45 
QuestionPrint a datagridview bound to a list<> Pin
Christian_V_V6-Apr-09 5:45
Christian_V_V6-Apr-09 5:45 
AnswerRe: Print a datagridview bound to a list<> Pin
Henry Minute6-Apr-09 6:25
Henry Minute6-Apr-09 6:25 
QuestionDataset table row edit mode Pin
dingo146-Apr-09 5:31
dingo146-Apr-09 5:31 
AnswerRe: Dataset table row edit mode Pin
Mycroft Holmes6-Apr-09 12:29
professionalMycroft Holmes6-Apr-09 12:29 
QuestionHelp For .Net ComponentClass help Pin
crrajaguru6-Apr-09 4:20
crrajaguru6-Apr-09 4:20 
AnswerRe: Help For .Net ComponentClass help Pin
Jack Li6-Apr-09 4:32
Jack Li6-Apr-09 4:32 
AnswerRe: Help For .Net ComponentClass help Pin
Henry Minute6-Apr-09 6:29
Henry Minute6-Apr-09 6:29 
QuestionReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
jas0n236-Apr-09 3:54
jas0n236-Apr-09 3:54 
AnswerRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
Mirko19806-Apr-09 4:11
Mirko19806-Apr-09 4:11 
AnswerRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
Deresen6-Apr-09 4:12
Deresen6-Apr-09 4:12 
To do this, you have to do something like this:

while(true)
{
  StringBuilder wholeText = "";
  String fileName = "file.txt";
  // create reader & open file
  Textreader tr = new StreamReader(fileName);

  // read a line of text
  String oneLine = tr.ReadLine();
  if(oneLine == null)
  {
     break;
  }
  else
  {
     doSomethingWith(oneLine);
  }

  while(String s = tr.ReadLine != null)
  {
     wholeText.add(String.Format("{0}\n",s);
  } 
  // close the stream
  tr.Close();

  //open the same file and write the text in there
  Textwriter tw = new StreamWriter(fileName);
  tw.write(wholeText.ToString());
  tw.Close();
}


This isn't tested, but the methodoligy should work.
AnswerRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
Luc Pattyn6-Apr-09 4:31
sitebuilderLuc Pattyn6-Apr-09 4:31 
AnswerRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
jas0n236-Apr-09 5:25
jas0n236-Apr-09 5:25 
GeneralRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
Luc Pattyn6-Apr-09 6:10
sitebuilderLuc Pattyn6-Apr-09 6:10 
GeneralRe: ReadLine, Perform Action, DeleteLine, ReadNextLine... Pin
jas0n2311-Apr-09 20:59
jas0n2311-Apr-09 20:59 
QuestionProblem with PropertyGrid Pin
sandeepkavade6-Apr-09 2:33
sandeepkavade6-Apr-09 2:33 
QuestionRemoting using WEBDAV Protocol Pin
balu123456-Apr-09 2:00
balu123456-Apr-09 2:00 
AnswerRe: Remoting using WEBDAV Protocol Pin
SeMartens6-Apr-09 2:29
SeMartens6-Apr-09 2:29 
Questiondisplay the items in a combobox Pin
ShivarajKumar6-Apr-09 1:44
ShivarajKumar6-Apr-09 1:44 
AnswerRe: display the items in a combobox Pin
akhilonly0076-Apr-09 1:58
akhilonly0076-Apr-09 1:58 
AnswerRe: display the items in a combobox Pin
Giorgi Dalakishvili6-Apr-09 2:05
mentorGiorgi Dalakishvili6-Apr-09 2:05 
QuestionHow to insert text to GIF and animate the text ? Pin
ErezRozn6-Apr-09 1:41
ErezRozn6-Apr-09 1:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.