EntryWrittenEventArgs クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EntryWrittenEventArgs クラスの意味・解説 

EntryWrittenEventArgs クラス

EntryWritten イベントデータ提供します

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public Class EntryWrittenEventArgs
    Inherits EventArgs
Dim instance As EntryWrittenEventArgs
public class EntryWrittenEventArgs : EventArgs
public ref class EntryWrittenEventArgs : public
 EventArgs
public class EntryWrittenEventArgs extends
 EventArgs
public class EntryWrittenEventArgs extends
 EventArgs
使用例使用例

EntryWrittenEventArgs コンストラクタの例を次に示します。これは、カスタム EventLog オブジェクト作成してエントリ書き込みます次にカスタム EventLog 内の最初エントリ使用して EntryWrittenEventArgs オブジェクト作成します。このオブジェクトは、メッセージ通知するときに使用します

Imports System
Imports System.Diagnostics

Class MySample
   Public Shared Sub Main()
      Try
         Dim myNewLog As New
 EventLog()
         myNewLog.Log = "MyNewLog"
         myNewLog.Source = "MySource"
         ' Create the source if it does not exist already.
         If Not EventLog.SourceExists("MySource")
 Then
            EventLog.CreateEventSource("MySource",
 "MyNewLog")
            Console.WriteLine("CreatingEventSource")
         End If
         ' Write an entry to the EventLog.
         myNewLog.WriteEntry("The Latest entry in the Event Log")
         Dim myEntryEventArgs As EntryWrittenEventArgs
 = _
                                    New EntryWrittenEventArgs()
         MyOnEntry(myNewLog, myEntryEventArgs)
      Catch e As Exception
         Console.WriteLine("Exception Raised" + e.Message)
      End Try
   End Sub 'Main
   Protected Shared Sub
 MyOnEntry(ByVal source As Object,
 _
                                  ByVal e As
 EntryWrittenEventArgs)
      If e.Entry Is Nothing
 Then
          Console.WriteLine("A new entry is written in MyNewLog.")
      End If
   End Sub 'MyOnEntry
End Class 'MySample
using System;
using System.Diagnostics;

   class MySample
   {
      public static void
 Main()
      {
         try
         {
            EventLog myNewLog = new EventLog();
            myNewLog.Log = "MyNewLog";
            myNewLog.Source="MySource";
            // Create the source if it does not exist already.
            if(!EventLog.SourceExists("MySource"))
            {
               EventLog.CreateEventSource("MySource", "MyNewLog");
               Console.WriteLine("CreatingEventSource");
            }
               // Write an entry to the EventLog.
               myNewLog.WriteEntry("The Latest entry in the
 Event Log");
            int myEntries = myNewLog.Entries.Count;
            EventLogEntry entry =myNewLog.Entries[myEntries-1];
            EntryWrittenEventArgs myEntryEventArgs=
                                 new EntryWrittenEventArgs();
            MyOnEntry(myNewLog,myEntryEventArgs);
         }
         catch(Exception e)
         {
            Console.WriteLine("Exception Raised" +e.Message);
         }
      }
      protected static void
 MyOnEntry(Object source, EntryWrittenEventArgs e)
      {
         if(e.Entry == null)
            Console.WriteLine("A new entry is written in
 MyNewLog.");
      }
   }
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;

void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e )
{
   if ( !e->Entry )
      Console::WriteLine( "A new entry is written in
 MyNewLog." );
}

int main()
{
   try
   {
      EventLog^ myNewLog = gcnew EventLog;
      myNewLog->Log = "MyNewLog";
      myNewLog->Source = "MySource";
      
      // Create the source if it does not exist already.
      if (  !EventLog::SourceExists( "MySource" ) )
      {
         EventLog::CreateEventSource( "MySource", "MyNewLog"
 );
         Console::WriteLine( "CreatingEventSource" );
      }
      
      // Write an entry to the EventLog.
      myNewLog->WriteEntry( "The Latest entry in the Event
 Log" );
      int myEntries = myNewLog->Entries->Count;
      EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ];
      EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs;
      MyOnEntry( myNewLog, myEntryEventArgs );
   }
   catch ( Exception^ e ) 
   {
      Console::WriteLine( "Exception Raised{0}", e->Message );
   }
}
import System.*;
import System.Diagnostics.*;

class MySample
{
    public static void main(String[]
 args)
    {
        try {
            EventLog myNewLog = new EventLog();
            myNewLog.set_Log("MyNewLog");
            myNewLog.set_Source("MySource");

            // Create the source if it does not exist already.
            if (!(EventLog.SourceExists("MySource")))
 {
                EventLog.CreateEventSource("MySource", "MyNewLog");
                Console.WriteLine("CreatingEventSource");
            }
            // Write an entry to the EventLog.
            myNewLog.WriteEntry("The Latest entry in the
 Event Log");
            int myEntries = myNewLog.get_Entries().get_Count();
            EventLogEntry entry = myNewLog.get_Entries().
                get_Item((myEntries - 1));
            EntryWrittenEventArgs myEntryEventArgs = new EntryWrittenEventArgs();
            MyOnEntry(myNewLog, myEntryEventArgs);
        }
        catch (System.Exception e) {
            Console.WriteLine("Exception Raised" + e.get_Message());
        }
    } //main

    private static void
 MyOnEntry(Object source, EntryWrittenEventArgs e)
    {
        if (e.get_Entry() == null) {
            Console.WriteLine("A new entry is written in
 MyNewLog.");
        }
    } //MyOnEntry
} //MySample
継承階層継承階層
System.Object
   System.EventArgs
    System.Diagnostics.EntryWrittenEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EntryWrittenEventArgs メンバ
System.Diagnostics 名前空間
EntryWritten
EntryWrittenEventHandler
EventLog



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「EntryWrittenEventArgs クラス」の関連用語

EntryWrittenEventArgs クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EntryWrittenEventArgs クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS