Click here to Skip to main content
15,887,585 members
Home / Discussions / C#
   

C#

 
AnswerRe: Problem to save usercontrol as .bmp image Pin
DidiKunz14-May-09 5:01
DidiKunz14-May-09 5:01 
QuestionHow to access String from within whole application... Pin
Baeltazor14-May-09 3:36
Baeltazor14-May-09 3:36 
AnswerRe: How to access String from within whole application... Pin
Henry Minute14-May-09 3:44
Henry Minute14-May-09 3:44 
GeneralRe: How to access String from within whole application... Pin
Baeltazor14-May-09 3:48
Baeltazor14-May-09 3:48 
QuestionSearch Data from File in FIle2 Pin
MumbleB14-May-09 3:32
MumbleB14-May-09 3:32 
AnswerRe: Search Data from File in FIle2 Pin
stancrm14-May-09 3:37
stancrm14-May-09 3:37 
GeneralRe: Search Data from File in FIle2 Pin
MumbleB14-May-09 3:54
MumbleB14-May-09 3:54 
AnswerRe: Search Data from File in FIle2 Pin
musefan14-May-09 3:54
musefan14-May-09 3:54 
your foreach will only loop once as your only giving in one string in the holdLineHid (which i assume is a string)

what you want to do is create a streamreader for file 1.
Read the first line into a string and then create a while loop while not null ...

StreamReader sr = new StreamReader("file1");

string line = sr.ReadLine();

while(line != null)
{
    //do something with the line
    line = sr.ReadLine();
}

sr.close();


Now, in your instance for file 1 you have put two id numbers on each line. Are they one per line in the file? or is there more than one on each line?

Then in your while loop, where i put the comment you could do the following...

StreamReader sr2 = new StreamReader("file2");

string line2 = sr2.ReadLine();

while(line2 != null)
{
   string hid = line2.Substring(0, 11);
   
   if(hid == line1)
   {
      //Do something with the stream writer
      break;//Break the while loop
   }

   line2 = sr2.ReadLine();
}

sr2.Close();


That should do what you want

Life goes very fast. Tomorrow, today is already yesterday.

GeneralRe: Search Data from File in FIle2 Pin
MumbleB14-May-09 18:56
MumbleB14-May-09 18:56 
QuestionProblem instantiating form classes created in other C# project Pin
Jacobus0114-May-09 3:07
Jacobus0114-May-09 3:07 
AnswerRe: Problem instantiating form classes created in other C# project Pin
sudman114-May-09 3:12
sudman114-May-09 3:12 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Jacobus0114-May-09 3:24
Jacobus0114-May-09 3:24 
AnswerRe: Problem instantiating form classes created in other C# project Pin
DaveyM6914-May-09 3:13
professionalDaveyM6914-May-09 3:13 
AnswerRe: Problem instantiating form classes created in other C# project Pin
Henry Minute14-May-09 3:30
Henry Minute14-May-09 3:30 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Jacobus0114-May-09 3:41
Jacobus0114-May-09 3:41 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Henry Minute14-May-09 3:50
Henry Minute14-May-09 3:50 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Jacobus0114-May-09 3:57
Jacobus0114-May-09 3:57 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Henry Minute14-May-09 4:02
Henry Minute14-May-09 4:02 
GeneralRe: Problem instantiating form classes created in other C# project Pin
Jacobus0114-May-09 4:08
Jacobus0114-May-09 4:08 
QuestionHow to enable tollbar in windows taskbar Pin
Radzivil Vladimir14-May-09 2:25
Radzivil Vladimir14-May-09 2:25 
AnswerRe: How to enable tollbar in windows taskbar Pin
Henry Minute14-May-09 3:38
Henry Minute14-May-09 3:38 
QuestionLinq To Xml help Pin
Miroslav8814-May-09 2:00
Miroslav8814-May-09 2:00 
Questionremoting security/permissioning exception... Pin
devvvy14-May-09 1:55
devvvy14-May-09 1:55 
QuestionHow to Create Crystal Report into Visual Studio 2008 (Windows Form) application? Pin
btough14-May-09 1:41
btough14-May-09 1:41 
QuestionPage indexing in c# Pin
Sajjad Leo14-May-09 1:39
Sajjad Leo14-May-09 1:39 

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.