<%@ Page Language="VB" %>
<%@ Import Namespace="System.Diagnostics" %>

<script runat="server">
    Protected Sub Page_Load(ByVal sender As Object, 
      ByVal e As System.EventArgs)

        If Not EventLog.SourceExists("Moja aplikacja") Then
            EventLog.CreateEventSource("Moja aplikacja", "Application")
        End If
    End Sub
    
    Protected Sub Button1_Click(ByVal sender As Object, 
      ByVal e As System.EventArgs)

        Dim el As EventLog = New EventLog()
        el.Source = "Moja aplikacja"
        el.WriteEntry(TextBox1.Text)

        Label1.Text = "WPROWADZONO: " & TextBox1.Text
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Zapisywanie informacji w dzienniku zdarzeń</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="TextBox1" runat="server" Height="75px" 
         TextMode="MultiLine" Width="250px"></asp:TextBox><br />
        <br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" 
         Text="Zapisz w dzienniku zdarzeń" /><br />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>&nbsp;</div>
    </form>
</body>
</html>
