<%@ Page Language="VB" %>

<script runat="server">
  Protected Sub Calculate_Click(ByVal sender As Object, _
     ByVal e As System.EventArgs)
  
    Dim Divide As New DivideComponent.DivideClass()

    Try
       Answer.Text = Divide.DivideNumber(Numerator.Text, Denominator.Text)
    Catch ex As Exception
       Answer.Text = ex.Message.ToString()
    End Try

    System.Runtime.InteropServices.Marshal.ReleaseComObject(Divide)

  End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
  <head runat="server">
     <title>Wykorzystanie komponentów COM</title>
  </head>
  <body>
    <form id="form1" runat="server">
      <p>
        <asp:Label ID="Label1" runat="server">Licznik:</asp:Label>
        &nbsp;
        <asp:TextBox ID="Numerator" runat="server"></asp:TextBox>
      </p>
      <p>
        <asp:Label ID="Label2" runat="server">Mianownik:</asp:Label>
        &nbsp;
        <asp:TextBox ID="Denominator" runat="server"></asp:TextBox>
      </p>
      <p>
        <asp:Label ID="Label3" runat="server">
         Wynik podzielenia licznika przez mianownik:</asp:Label>
        &nbsp;
        <asp:Label ID="Answer" runat="server" Font-Bold="True">0</asp:Label>
      </p>
      <p>
        <asp:Button ID="Calculate" 
         runat="server"
         OnClick="Calculate_Click"
         Text="Oblicz">
        </asp:Button>
      </p>
    </form>
  </body>
</html>

