向系统日志 写入自定义数据

实现效果:

  

知识运用:

  EventLog类的Source属性和WriteEntry方法

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            EventLog eventlog = new EventLog();
            eventlog.Source = "System";
            eventlog.WriteEntry(textBox1.Text);
        }

  

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10300778.html
今日推荐