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. Text/Log Files

Text/Log Files

Scheduled Pinned Locked Moved C#
csharpsysadminwindows-adminhelptutorial
3 Posts 2 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.
  • V Offline
    V Offline
    velkropie
    wrote on last edited by
    #1

    Hello, I was looking at the log files for IIS, and want to display them in a windows form using c#. I already know how to just display them inside a textbox, but the content is not display in a friendly manner. what i need help with, is displaying each section or part before the comma in its own textbox or control. 193.1*.7*.*, WebUser, 3/28/2006, 0:00:04, MSFTPSVC1, SERVER, 1*.1*.1.1*, 0, 0, 0, 331, 0, [57]USER, WebUser, -, as you can see the log file is comma delimited... i hope you understand my question... thanks The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!

    L 1 Reply Last reply
    0
    • V velkropie

      Hello, I was looking at the log files for IIS, and want to display them in a windows form using c#. I already know how to just display them inside a textbox, but the content is not display in a friendly manner. what i need help with, is displaying each section or part before the comma in its own textbox or control. 193.1*.7*.*, WebUser, 3/28/2006, 0:00:04, MSFTPSVC1, SERVER, 1*.1*.1.1*, 0, 0, 0, 331, 0, [57]USER, WebUser, -, as you can see the log file is comma delimited... i hope you understand my question... thanks The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!

      L Offline
      L Offline
      Le centriste
      wrote on last edited by
      #2

      A good started could be string[] logFields = logLine.Split(','); -------- "I say no to drugs, but they don't listen." - Marilyn Manson

      V 1 Reply Last reply
      0
      • L Le centriste

        A good started could be string[] logFields = logLine.Split(','); -------- "I say no to drugs, but they don't listen." - Marilyn Manson

        V Offline
        V Offline
        velkropie
        wrote on last edited by
        #3

        Michel Prévost wrote:

        A good started could be string[] logFields = logLine.Split(',');

        this is what i have showing in a text box... how will your line fit here... private void btnOpenFile_Click(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); dlg.Title = "Open File"; dlg.InitialDirectory = @"c:\"; dlg.Filter = "Text Files (*.txt) | *.txt |Log Files (*.log) | *.log | All Files (*.*) | *.*"; if (dlg.ShowDialog() == DialogResult.OK) { StreamReader sr = File.OpenText(dlg.FileName); string s = sr.ReadLine(); StringBuilder sb = new StringBuilder(); while (s != null) { sb.Append(s); s = sr.ReadLine(); } sr.Close(); txtContent.Text = sb.ToString(); } The Devil Lives in all of us, It's up to you to let HIM/HER out!!!!!

        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