Advertisement
tankcr

eventlogForm

Jun 5th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. namespace SysTools
  2. {
  3.     public partial class LogViewer : Form
  4.     {
  5.         DataTable eventLog = new DataTable();
  6.         DataSet dataset1 = new DataSet();
  7.         public LogViewer(EventLog logs)
  8.         {
  9.             EventLog currentLog = logs;
  10.             DataTable dataTable1 = new DataTable();
  11.             dataTable1.Rows.Clear();
  12.             for (int currLogIndex = 1; currLogIndex <= logs.Entries.Count; currLogIndex++)
  13.             {
  14.                 DataRow drnew = dataTable1.NewRow();
  15.                 EventLogEntry currLogEntry = logs.Entries[currLogIndex];
  16.                 drnew["Category"] = currLogEntry.Source;
  17.                 dataTable1.Rows.Add(drnew);
  18.             }
  19.             InitializeComponent();
  20.             dataGridView1.DataSource = dataTable1;
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement