Click here to Skip to main content
15,891,607 members
Home / Discussions / C#
   

C#

 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 1157009831-Mar-15 8:28
Member 1157009831-Mar-15 8:28 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
OriginalGriff31-Mar-15 8:45
mveOriginalGriff31-Mar-15 8:45 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 1157009831-Mar-15 15:27
Member 1157009831-Mar-15 15:27 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
OriginalGriff31-Mar-15 22:00
mveOriginalGriff31-Mar-15 22:00 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 115700981-Apr-15 6:17
Member 115700981-Apr-15 6:17 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
OriginalGriff1-Apr-15 6:59
mveOriginalGriff1-Apr-15 6:59 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 115700981-Apr-15 9:24
Member 115700981-Apr-15 9:24 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 115700981-Apr-15 11:54
Member 115700981-Apr-15 11:54 
this is what I tried to do to sort the #s into files: I found a getFiles method in a Process directory method and my intent was to import the whole directory and read each file and write the contence to the sorted file as you suggested, however nothing appears in the Sorted file after I run it. If you see why please let me know I will still keep trying to debug it but if a glaring error pops out to you please let me know, thanks
C#

   private void button2_Click(object sender, EventArgs e)
        {
            string path = @"C:Random # File.txt";
            StreamReader readtext = new StreamReader(path);
            StreamWriter writetext = new StreamWriter("write.txt");
            for (int j = 0; j < 20; j++)
            {
                string readmetext = readtext.ReadLine();
                writetext.WriteLine(Convert.ToInt32(readmetext));

<pre>
        }//C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut
        writetext.Close();
        readtext.Close();
        StreamReader rt = new StreamReader(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\write.txt");

        for (int i = 0; i &lt; 20; i++)
        {
            int files = rt.Read();
            File.WriteAllText(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\temp\"
                + files.ToString("0000") + ".txt", files.ToString());

            //     File.WriteAllText(@"C:\Users\Desktop\grantlinhart\Documents\WorkingFolder\" + files.ToString("0000") + ".txt", files.ToString());
        }
        rt.Close();
        ProcessDirectory(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\temp\");
    }
    public static void ProcessDirectory(string targetDirectory)
    {
        string variable1;
        StreamReader readToSort = new StreamReader(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\write.txt");
        StreamWriter writeSorted = new StreamWriter(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\Sorted_File.txt");
        // Process the list of files found in the directory. 
        string[] fileEntries = Directory.GetFiles(@"C:\Users\grantlinhart\Documents\Visual Studio 2013\Projects\InputOut\InputOut\bin\Debug\temp\");
        foreach (string fileName in fileEntries)
        {   //  ProcessFile(fileName);
            variable1 = readToSort.ReadLine();
            writeSorted.WriteLine(variable1.ToString() + "\n");
        }
    }</pre>

GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 1157009831-Mar-15 6:26
Member 1157009831-Mar-15 6:26 
GeneralRe: trying to search a text file for a certain string and display it in a richTextBox Pin
Member 1157009831-Mar-15 5:01
Member 1157009831-Mar-15 5:01 
QuestionSplit list to two gridview columns in C# winforms Pin
arsale31-Mar-15 3:27
arsale31-Mar-15 3:27 
AnswerRe: Split list to two gridview columns Pin
Eddy Vluggen31-Mar-15 7:31
professionalEddy Vluggen31-Mar-15 7:31 
GeneralRe: Split list to two gridview columns Pin
arsale31-Mar-15 10:46
arsale31-Mar-15 10:46 
GeneralRe: Split list to two gridview columns Pin
Eddy Vluggen31-Mar-15 13:03
professionalEddy Vluggen31-Mar-15 13:03 
GeneralRe: Split list to two gridview columns Pin
arsale31-Mar-15 23:20
arsale31-Mar-15 23:20 
GeneralRe: Split list to two gridview columns Pin
Eddy Vluggen31-Mar-15 23:41
professionalEddy Vluggen31-Mar-15 23:41 
GeneralRe: Split list to two gridview columns Pin
arsale31-Mar-15 23:58
arsale31-Mar-15 23:58 
GeneralRe: Split list to two gridview columns Pin
arsale1-Apr-15 0:09
arsale1-Apr-15 0:09 
GeneralRe: Split list to two gridview columns Pin
Eddy Vluggen1-Apr-15 0:24
professionalEddy Vluggen1-Apr-15 0:24 
GeneralRe: Split list to two gridview columns Pin
arsale1-Apr-15 0:28
arsale1-Apr-15 0:28 
QuestionCould not cal the repaint usercontrol?? Pin
Sarita S31-Mar-15 0:05
Sarita S31-Mar-15 0:05 
AnswerRe: Could not cal the repaint usercontrol?? Pin
OriginalGriff31-Mar-15 0:16
mveOriginalGriff31-Mar-15 0:16 
GeneralRe: Could not cal the repaint usercontrol?? Pin
Sarita S31-Mar-15 0:21
Sarita S31-Mar-15 0:21 
GeneralRe: Could not cal the repaint usercontrol?? Pin
OriginalGriff31-Mar-15 0:22
mveOriginalGriff31-Mar-15 0:22 
GeneralRe: Could not cal the repaint usercontrol?? Pin
Sarita S31-Mar-15 0:49
Sarita S31-Mar-15 0:49 

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.