using System.Diagnostic;EventLog myNewLog = new EventLog();
myNewLog.Log = "System Log";//或者是"Application Log" , "Security Log"
myNewLog.MachineName="你的计算机名";
foreach(EventLogEntry entry in myNewLog.Entries)
{
listBox1.Items.Add(entry.Message);
}
myNewLog.Log = "System Log";//或者是"Application Log" , "Security Log"
myNewLog.MachineName="你的计算机名";
foreach(EventLogEntry entry in myNewLog.Entries)
{
listBox1.Items.Add(entry.Message);
}
解决方案 »
- VS2005 下如何使用统计用图形表示出来的功能? VS2010就可以用
- 帮忙啊,关于文本框输入,限制输入字符的问题
- <SCRIPT language=JAVASCRIPT src="e.js"></SCRIPT> ,要是有了e.js,怎么将这个文件写进去那个语句,省去src语句呢?
- 让程序暂停1秒,除了线程外有没有什么好方法,急 结贴迅速
- 有xml数据,能否在c#中压缩,然后在vb6.0中解压?
- 请教:给子窗体传递SQLConnection的问题,up有分,不够再加
- 急:如何在一个循环中创建控件,且自动的给唯一的名字?
- 计算两控件的坐标,然后用直线将他们相连
- 如何给窗体边框添加颜色?
- datagridview Update时的问题
- C#中访问数据库两个简单的问题
- 谁能帮我理解"接口"
写入日志:
byte[] myByte=new byte[10];
for(int i=0;i<10;i++)
{
myByte[i]= (byte)(i % 2);
}
// Write an informational entry to the event log.
EventLog.WriteEntry("SecondSource","Writing warning to event log.",
EventLogEntryType.Error,123,1 ,myByte);
读取日志:
EventLog sample=new EventLog();
sample.Log="Application";
EventLogEntryCollection myCollection=sample.Entries;
foreach(EventLogEntry test in myCollection) { Console.WriteLine(test.Message,test.Source,test.EventID); }
thanks!