RSS Forums RSS
Please support our C# advertiser: Programming Forums
Views: 7129 | Replies: 4 | Solved
Reply
Join Date: Jul 2005
Location: FL.
Posts: 1,536
Reputation: tayspen is on a distinguished road 
Rep Power: 7
Solved Threads: 98
Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

Read text file to a certain point

  #1  
Sep 25th, 2005
Ok so i want my program to read a text file to a certain point. Lets say to the line line that says fn: i then want it to read the one line only and only the the text after fn: and i want it to shoew that text in a text box. i no it can be done. but i dont know how. if any body knows would you min sharing

-T
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2003
Posts: 55
Reputation: r0ckbaer is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 6
r0ckbaer r0ckbaer is offline Offline
Junior Poster in Training

Re: Read text file to a certain point

  #2  
Sep 26th, 2005
StreamReader sr = new StreamReader("yourFileNameGoesHere", System.Text.Encoding.Default);
			string s = null;

			while ((s = sr.ReadLine()) != null)
			{
				if (s.IndexOf("fn:") != -1)
				{
					// ok, you found it
					// now you can do like 
					// textBox1.text = s;
					break;
				}
			}

			sr.Close();
Reply With Quote  
Join Date: Jul 2005
Location: FL.
Posts: 1,536
Reputation: tayspen is on a distinguished road 
Rep Power: 7
Solved Threads: 98
Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

Re: Read text file to a certain point

  #3  
Sep 26th, 2005
Thank you so much, man you have helped me learn C# so much. I really thank you for all of your help.


-T
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
Reply With Quote  
Join Date: Jul 2005
Location: FL.
Posts: 1,536
Reputation: tayspen is on a distinguished road 
Rep Power: 7
Solved Threads: 98
Colleague
tayspen's Avatar
tayspen tayspen is offline Offline
<Insert title here>

Re: Read text file to a certain point

  #4  
Sep 26th, 2005
Originally Posted by tayspen
Thank you so much, man you have helped me learn C# so much. I really thank you for all of your help.


-T

hmmm but how can i make it so it only shos what comes after fn: not inl;uding fn:?
Firefox
Ewido
Tune up windows
Get detailed system information
My Fixes

Member - Alliance of Security Analysis Professionals - Since 2006
Reply With Quote  
Join Date: Sep 2005
Posts: 17
Reputation: ROGENATOR is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 0
ROGENATOR's Avatar
ROGENATOR ROGENATOR is offline Offline
Newbie Poster

Re: Read text file to a certain point

  #5  
Sep 29th, 2005
Grretings:
Just remove that part from the string:
s.Remove(0,3);
the remove method takes two parameter, the index where you want to start removing and length you wish to remove
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 5:39 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC