Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Sorting of data (item) inside the text file.

Sorting of data (item) inside the text file.

Scheduled Pinned Locked Moved C#
algorithmshelptutorialquestionlearning
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jrbvillanueva
    wrote on last edited by
    #1

    guys, i dont know how to sort the data(item)inside the text file alphabetically line by line? - i read my book and read help but no information regarding that matter.. can you give me the codes for that so i'm able to easily understand. Hope ur help and response... tnx a lot.. regards, JayR

    L 1 Reply Last reply
    0
    • J jrbvillanueva

      guys, i dont know how to sort the data(item)inside the text file alphabetically line by line? - i read my book and read help but no information regarding that matter.. can you give me the codes for that so i'm able to easily understand. Hope ur help and response... tnx a lot.. regards, JayR

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      private void MenuItem_SampleSortFile_Click(object sender, System.EventArgs e)
      {
      ArrayList list = new ArrayList();
      list.Add("I don't know how to sort the data");
      list.Add("inside the text file line by line");
      list.Add("I read my book and read help");
      list.Add("but no information regarding that matter");
      list.Add("can you give me the codes");
      list.Add("so I am able to easily understand");
      list.Add("Hope your help and response");

      list.Sort();
      
      System.IO.StreamWriter writer = new System.IO.StreamWriter("c:\\\\test.txt");
      foreach( string sline in list)
      	writer.WriteLine( sline);
      writer.Flush();
      writer.Close();
      

      }

      "What classes are you using ? You shouldn't call stuff if you have no idea what it does"
      Christian Graus in the C# forum

      led mike

      J 1 Reply Last reply
      0
      • L led mike

        private void MenuItem_SampleSortFile_Click(object sender, System.EventArgs e)
        {
        ArrayList list = new ArrayList();
        list.Add("I don't know how to sort the data");
        list.Add("inside the text file line by line");
        list.Add("I read my book and read help");
        list.Add("but no information regarding that matter");
        list.Add("can you give me the codes");
        list.Add("so I am able to easily understand");
        list.Add("Hope your help and response");

        list.Sort();
        
        System.IO.StreamWriter writer = new System.IO.StreamWriter("c:\\\\test.txt");
        foreach( string sline in list)
        	writer.WriteLine( sline);
        writer.Flush();
        writer.Close();
        

        }

        "What classes are you using ? You shouldn't call stuff if you have no idea what it does"
        Christian Graus in the C# forum

        led mike

        J Offline
        J Offline
        jrbvillanueva
        wrote on last edited by
        #3

        Hi led mike... It works! It helps a lot.. Thank you so much... regards, JayR

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups