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

C#

 
GeneralScan and Compare Pin
Eolus6-Apr-04 4:17
Eolus6-Apr-04 4:17 
GeneralRe: Scan and Compare Pin
Heath Stewart6-Apr-04 5:15
protectorHeath Stewart6-Apr-04 5:15 
GeneralRe: Scan and Compare Pin
Eolus6-Apr-04 21:04
Eolus6-Apr-04 21:04 
GeneralRe: Scan and Compare Pin
Bill Dean7-Apr-04 2:37
Bill Dean7-Apr-04 2:37 
GeneralRe: Scan and Compare Pin
Heath Stewart7-Apr-04 3:12
protectorHeath Stewart7-Apr-04 3:12 
GeneralRe: Scan and Compare Pin
Eolus7-Apr-04 3:32
Eolus7-Apr-04 3:32 
GeneralRe: Scan and Compare Pin
Heath Stewart7-Apr-04 3:37
protectorHeath Stewart7-Apr-04 3:37 
GeneralRe: Scan and Compare Pin
Bill Dean7-Apr-04 7:01
Bill Dean7-Apr-04 7:01 
So the textbox can contain an arbitrary number of <name>'s? For example: one time I could enter '<FHGO>SomeText', next time '<FGHO><A>SomeOtherText', third try '<FGHO><A><BIG>SomeThingElse' and you want to get 1, 2 or 3 (or N) code blocks?

If so, you need to two two things:
1) parse up your textbox string into individual <name>'s. Here the Regex class Heath refered to is an IDEAL tool.

2) for each <name> you get, search the file. You'll want to do write a method something like:
<code>
private string strFindCode(strName){
TextReader trCodeFile;
//open the text file here....

bool bFoundIt=false;
string strCurrentLine;
string strCodeBlock="";
while(trCodeFile.Peek()>-1 && !bFoundIt){
strCurrentLine = trCodeFile.ReadLine();
if (strCurrentLine.IndexOf(strName)>-1){
bFoundIt=true;
strCurrentLine = trCodeFile.ReadLine();
while (strCurrentLine != ""){
strCodeBlock+=strCurrentLine +"\n";
strCurrentLine = trCodeFile.ReadLine();
}
}

}
trCodeFile.Close();
if (bFoundIt){
return(strCodeBlock);
}else{
return("Name Not Found");
}
</code>

I have not compiled, much less run, this code. So I make no promises...but hopefully it points you in the right direction algorithmicly.

Bill

ps: please don't everyone jump on me for not using the StringBuilder...
GeneralTextBox Paste Pin
Simon Wren6-Apr-04 3:00
professionalSimon Wren6-Apr-04 3:00 
GeneralRe: TextBox Paste Pin
Heath Stewart6-Apr-04 3:34
protectorHeath Stewart6-Apr-04 3:34 
GeneralRe: TextBox Paste Pin
Simon Wren6-Apr-04 3:37
professionalSimon Wren6-Apr-04 3:37 
QuestionHow I may safe close my application? Pin
novitzky6-Apr-04 2:59
novitzky6-Apr-04 2:59 
AnswerRe: How I may safe close my application? Pin
Simon Wren6-Apr-04 3:06
professionalSimon Wren6-Apr-04 3:06 
GeneralRe: How I may safe close my application? Pin
Heath Stewart6-Apr-04 3:40
protectorHeath Stewart6-Apr-04 3:40 
GeneralRe: How I may safe close my application? Pin
Simon Wren6-Apr-04 3:46
professionalSimon Wren6-Apr-04 3:46 
GeneralRe: How I may safe close my application? Pin
Heath Stewart6-Apr-04 3:51
protectorHeath Stewart6-Apr-04 3:51 
AnswerRe: How I may safe close my application? Pin
LongRange.Shooter6-Apr-04 3:08
LongRange.Shooter6-Apr-04 3:08 
AnswerRe: How I may safe close my application? Pin
Colin Angus Mackay6-Apr-04 3:11
Colin Angus Mackay6-Apr-04 3:11 
AnswerRe: How I may safe close my application? Pin
novitzky6-Apr-04 4:22
novitzky6-Apr-04 4:22 
GeneralDisabling Text Wrap on DrawString() Pin
Tristan Rhodes6-Apr-04 2:54
Tristan Rhodes6-Apr-04 2:54 
GeneralRe: Disabling Text Wrap on DrawString() Pin
Heath Stewart6-Apr-04 3:23
protectorHeath Stewart6-Apr-04 3:23 
QuestionDirect X transformation? Pin
SherKar6-Apr-04 2:53
SherKar6-Apr-04 2:53 
AnswerRe: Direct X transformation? Pin
Heath Stewart6-Apr-04 3:22
protectorHeath Stewart6-Apr-04 3:22 
GeneralRe: Direct X transformation? Pin
SherKar7-Apr-04 4:29
SherKar7-Apr-04 4:29 
GeneralRe: Direct X transformation? Pin
Heath Stewart7-Apr-04 5:17
protectorHeath Stewart7-Apr-04 5:17 

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.