Click here to Skip to main content
15,911,786 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get Country List with Two-letter country codes? Pin
Richard MacCutchan24-Feb-10 3:19
mveRichard MacCutchan24-Feb-10 3:19 
AnswerRe: How to get Country List with Two-letter country codes? Pin
Gonzoox24-Feb-10 3:45
Gonzoox24-Feb-10 3:45 
AnswerRe: How to get Country List with Two-letter country codes? Pin
Bernhard Hiller26-Feb-10 0:04
Bernhard Hiller26-Feb-10 0:04 
Questionsocket Pin
aurelcly23-Feb-10 22:35
aurelcly23-Feb-10 22:35 
AnswerRe: socket Pin
Richard MacCutchan24-Feb-10 1:24
mveRichard MacCutchan24-Feb-10 1:24 
AnswerRe: socket Pin
PIEBALDconsult24-Feb-10 9:27
mvePIEBALDconsult24-Feb-10 9:27 
QuestionDeleting an occurance of a string Pin
muka6623-Feb-10 22:20
muka6623-Feb-10 22:20 
AnswerRe: Deleting an occurance of a string Pin
OriginalGriff23-Feb-10 22:39
mveOriginalGriff23-Feb-10 22:39 
You are having problems all over the place there, my friend!
Firstly, never use "Magic numbers" such as
for (int i = 0; i < 500; i++)
I see what you are doing, but don't! Instead, loop around on the EndOfStream or the ReadLine.
In actual fact, unless there is a good reason why you want to process the first 500 lines only, consider using File.ReadAllText instead.

Secondly, it looks like you are trying to use a regular expression, but failing.

Thirdly, unless every single line contains the img tag, you loop terminates on the first non match.

What you want to do is (pseudo code):

Allocate a string to hold the file content, and use File.ReadAllText to read the whole thing. This allows for img tags which span lines.
Set up a Regex to hold your img tag seeker.
Use Regex.Replace to replace all instances of the img tag in the file.
Use String.Split to break your file into the various lines, if you need it afterwards.

No loop required!

If you aren't sure how to use any of these, google for File.ReadAllText etc. and you will get instructions!
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace

C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy

GeneralRe: Deleting an occurance of a string Pin
muka6624-Feb-10 1:28
muka6624-Feb-10 1:28 
GeneralRe: Deleting an occurance of a string Pin
OriginalGriff24-Feb-10 4:35
mveOriginalGriff24-Feb-10 4:35 
GeneralRe: Deleting an occurance of a string Pin
OriginalGriff24-Feb-10 4:37
mveOriginalGriff24-Feb-10 4:37 
AnswerRe: Deleting an occurance of a string Pin
Ravi Bhavnani24-Feb-10 7:44
professionalRavi Bhavnani24-Feb-10 7:44 
QuestionAcquireReaderLock Problems Pin
Sandy-Lee23-Feb-10 22:07
Sandy-Lee23-Feb-10 22:07 
AnswerRe: AcquireReaderLock Problems Pin
Richard MacCutchan24-Feb-10 1:29
mveRichard MacCutchan24-Feb-10 1:29 
Questionconnecting to telnet and executing perl script [modified] Pin
l.laxmikant23-Feb-10 21:49
l.laxmikant23-Feb-10 21:49 
AnswerRe: connecting to telnet and executing perl script Pin
Richard MacCutchan23-Feb-10 21:55
mveRichard MacCutchan23-Feb-10 21:55 
GeneralRe: connecting to telnet and executing perl script Pin
l.laxmikant23-Feb-10 22:00
l.laxmikant23-Feb-10 22:00 
GeneralRe: connecting to telnet and executing perl script Pin
Pete O'Hanlon23-Feb-10 22:28
mvePete O'Hanlon23-Feb-10 22:28 
GeneralRe: connecting to telnet and executing perl script Pin
l.laxmikant23-Feb-10 22:58
l.laxmikant23-Feb-10 22:58 
GeneralRe: connecting to telnet and executing perl script Pin
Pete O'Hanlon23-Feb-10 23:41
mvePete O'Hanlon23-Feb-10 23:41 
GeneralRe: connecting to telnet and executing perl script Pin
l.laxmikant24-Feb-10 0:22
l.laxmikant24-Feb-10 0:22 
GeneralRe: connecting to telnet and executing perl script Pin
Richard MacCutchan24-Feb-10 1:32
mveRichard MacCutchan24-Feb-10 1:32 
GeneralRe: connecting to telnet and executing perl script Pin
PIEBALDconsult24-Feb-10 9:33
mvePIEBALDconsult24-Feb-10 9:33 
AnswerRe: connecting to telnet and executing perl script [modified] Pin
PIEBALDconsult24-Feb-10 3:59
mvePIEBALDconsult24-Feb-10 3:59 
AnswerRe: connecting to telnet and executing perl script Pin
PIEBALDconsult1-Mar-10 4:16
mvePIEBALDconsult1-Mar-10 4:16 

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.