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
  1. Home
  2. General Programming
  3. C#
  4. beginner in C# needs help

beginner in C# needs help

Scheduled Pinned Locked Moved C#
tutorialcsharphelpquestionlounge
4 Posts 3 Posters 0 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.
  • K Offline
    K Offline
    keroed_edmond
    wrote on last edited by
    #1

    i have a .txt file that i have data in there that is seperated using comma and i want to read from this text file and collect all of the data from the text file for example ::::::::::::::::::::::::::: 12/4/2005,pin 23/4/2006,unpin i want to be able to read something like that and get all of the informations seperately so i kno that for the first line i have 12/4/2005 and pin differently and liewise for the other line ? can someone prob point me out to a tutorial that can show me how to do this or possibly show me a snippet of code to do this............ and in general i wold appreciate any links to tutorial for c# also __________________ kenny

    S 1 Reply Last reply
    0
    • K keroed_edmond

      i have a .txt file that i have data in there that is seperated using comma and i want to read from this text file and collect all of the data from the text file for example ::::::::::::::::::::::::::: 12/4/2005,pin 23/4/2006,unpin i want to be able to read something like that and get all of the informations seperately so i kno that for the first line i have 12/4/2005 and pin differently and liewise for the other line ? can someone prob point me out to a tutorial that can show me how to do this or possibly show me a snippet of code to do this............ and in general i wold appreciate any links to tutorial for c# also __________________ kenny

      S Offline
      S Offline
      Sean89
      wrote on last edited by
      #2

      Search "Reading a text file in C#" in google. Once you have a line of text from the file you can use string.Spilt(','); to seperate the info. Something like: string currentText; // text obtained from file string [] seperated = currentText.Split(',');


      K 1 Reply Last reply
      0
      • S Sean89

        Search "Reading a text file in C#" in google. Once you have a line of text from the file you can use string.Spilt(','); to seperate the info. Something like: string currentText; // text obtained from file string [] seperated = currentText.Split(',');


        K Offline
        K Offline
        keroed_edmond
        wrote on last edited by
        #3

        Thanks Sean89 i tried the snippet of code u gave me and i was able to sperate this sample text string i put in my code just to check :::: string cfvText="kenny,edmond,walker" ; ::::::: so i am goign to try and find a tutorial as u say that will assist me to read from a file in c# now, thanks again kenny

        L 1 Reply Last reply
        0
        • K keroed_edmond

          Thanks Sean89 i tried the snippet of code u gave me and i was able to sperate this sample text string i put in my code just to check :::: string cfvText="kenny,edmond,walker" ; ::::::: so i am goign to try and find a tutorial as u say that will assist me to read from a file in c# now, thanks again kenny

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          using(StreamReader sReader = new StreamReader(@"c:\temp\test.txt"))
          {
          string text = string.Empty;
          while((text = sReader.ReadLine()) != null)
          {
          Console.WriteLine(text);
          }
          }

          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