<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>由指定的來源寫入應用程式事件記錄檔</Title>
      <Author>Microsoft Corporation</Author>
      <Description>將訊息寫入應用程式事件記錄檔。</Description>
      <Shortcut>evWriteApp</Shortcut>
    </Header>
    <Snippet>
      <Imports>
        <Import>
          <Namespace>System</Namespace>
        </Import>
        <Import>
          <Namespace>System.Diagnostics</Namespace>
        </Import>
        <Import>
          <Namespace>Microsoft.VisualBasic</Namespace>
        </Import>
      </Imports>
      <Declarations>
        <Literal>
          <ID>EntryType</ID>
          <Type>EventLogEntryType</Type>
          <ToolTip>取代為列舉值。</ToolTip>
          <Default>EventLogEntryType.Warning</Default>
        </Literal>
        <Literal>
          <ID>SourceName</ID>
          <Type>String</Type>
          <ToolTip>取代為來源名稱。寫入事件時，來源名稱會與特定應用程式相關聯。</ToolTip>
          <Default>"SourceName"</Default>
        </Literal>
        <Literal>
          <ID>message</ID>
          <Type>String</Type>
          <ToolTip>取代為要寫入的訊息。</ToolTip>
          <Default>"Message text"</Default>
        </Literal>
        <Literal>
          <ID>LogName</ID>
          <Type>String</Type>
          <ToolTip>取代為記錄檔名稱。這樣會讀取本機電腦上的應用程式記錄檔。</ToolTip>
          <Default>"Application"</Default>
        </Literal>
        <Literal>
          <ID>Machine</ID>
          <Type>String</Type>
          <ToolTip>取代為電腦名稱。"." 代表本機電腦。</ToolTip>
          <Default>"Machine Name"</Default>
        </Literal>
        <Literal>
          <ID>EventID</ID>
          <Type>Integer</Type>
          <ToolTip>取代為整數值。您的應用程式會定義這些值及其意義。</ToolTip>
          <Default>123</Default>
        </Literal>
      </Declarations>
      <Code Language="VB" Kind="method body"><![CDATA[Dim log As New EventLog($LogName$, $Machine$, $SourceName$)
log.WriteEntry($message$, $EntryType$, $EventID$)]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>
