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

C#

 
GeneralRe: Regular Expresion Pin
ONeil Tomlinson14-May-09 4:54
ONeil Tomlinson14-May-09 4:54 
QuestionProblem to save usercontrol as .bmp image Pin
Seraph_summer14-May-09 3:40
Seraph_summer14-May-09 3:40 
AnswerRe: Problem to save usercontrol as .bmp image Pin
Luc Pattyn14-May-09 4:01
sitebuilderLuc Pattyn14-May-09 4:01 
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 
Hi Guys. I have been pulling out the last hair on my head with this one.

I have two files, one with a list of numbers and another file containing more data. I want to take the data from file 1 and use that to search file2 for the same value and out put another value from file1 to a new file. I have now tried numerous ways of writing this and it just doesn't work. Below is a snippet of my code. The foreach statement doesn't work and if I run it without the foreach statement it only reads the first line of file 1 and doesn't continue to the next line.
while (!sr1.EndOfStream)
{
    holdLineHid = sr1.ReadLine();
    holdLineNot = sr.ReadToEnd();
        if (String.IsNullOrEmpty(holdLineHid) || String.IsNullOrEmpty(holdLineNot))
            continue;
        string hid1 = holdLineHid.Substring(0, 11);
        string newhid = holdLineHid.Substring(14, 11);
        string hid2 = holdLineNot.Substring(0, 11);
        string notremainder = holdLineNot.Substring(11, 683).Trim();
        foreach (String hid in holdLineHid)
        {
            if (hid1 == hid2)
            {
                sw.WriteLine(newhid + notremainder);
            }

For instance:
In File1 I have the following:
<br />
C0000000001   C0000013456<br />
C0000000002   C0003245678<br />

In File2 I have the following data:
<br />
C0000000003N      Y     Trem    Chat<br />
C0000000005Y      C     Just    Data<br />
C0000000001N      D     This    Must Match<br />


How do I get this to run properly?

Thanks in advance.

Excellence is doing ordinary things extraordinarily well.

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 
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 

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.