
Partial Class MetricConverter
    Inherits System.Web.UI.Page


    Protected Sub cmdConvert_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdConvert.Click
        Dim Inches, Meters As Single
        Inches = 36 * Val(txtYards.Text) + 12 * Val(txtFeet.Text)
        Meters = Inches / 39.37
        lblResult.Text = "Result: " & Meters.ToString() & " Meters. "

        ' Retrieve the state information.
        Dim Counter As Integer = CType(ViewState("Counter"), Integer)

        ' Update the counter and display the result.
        Counter += 1
        lblResult.Text &= Counter.ToString() & " conversions performed."

        ' Store the new value.
        ViewState("Counter") = Counter

    End Sub

End Class
