Text/Log Files
-
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!!!!!
-
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!!!!!
A good started could be
string[] logFields = logLine.Split(',');
-------- "I say no to drugs, but they don't listen." - Marilyn Manson -
A good started could be
string[] logFields = logLine.Split(',');
-------- "I say no to drugs, but they don't listen." - Marilyn MansonMichel 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!!!!!