Skip to content

Instantly share code, notes, and snippets.

@epatr
Created August 6, 2018 16:25
Show Gist options
  • Save epatr/629592b15f279af3b1aebfc91bda60a6 to your computer and use it in GitHub Desktop.
Save epatr/629592b15f279af3b1aebfc91bda60a6 to your computer and use it in GitHub Desktop.
<%@ Page Title="Calculator" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Calculator.aspx.vb" Inherits="Fishbowl.Contact" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<h2><%: Title %>: Gallons of water to fill my aquarium.</h2>
<table class="nav-justified">
<tr>
<td style="width: 136px">Length (inches):</td>
<td style="width: 200px">
<asp:TextBox ID="txtLength" runat="server" Width="50px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtLength" ErrorMessage="* Required" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td rowspan="6">
<asp:Image ID="Image1" runat="server" ImageUrl="~/Aquarium.png" />
</td>
</tr>
<tr>
<td style="width: 136px">Width (inches):</td>
<td style="width: 200px">
<asp:TextBox ID="txtWidth" runat="server" Width="50px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtWidth" ErrorMessage="* Required" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 136px">Height (inches):</td>
<td style="width: 200px">
<asp:TextBox ID="txtHeight" runat="server" Width="50px"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtHeight" ErrorMessage="* Required" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td style="width: 136px">Water (gallons):</td>
<td style="width: 200px">
<asp:Label ID="lblGallons" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td style="width: 136px">&nbsp;</td>
<td style="width: 200px">&nbsp;</td>
</tr>
<tr>
<td style="width: 136px">&nbsp;</td>
<td style="width: 200px">
<asp:Button ID="btnSubmit" runat="server" Text="Submit" />
</td>
</tr>
</table>
</asp:Content>
' Programmer: Eric Patrick
Option Explicit On
Option Strict On
Option Infer Off
Public Class Contact
Inherits Page
Private Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
' Displays the number of gallons of water.
Dim dblLength As Double
Dim dblWidth As Double
Dim dblHeight As Double
Dim dblVolume As Double
Dim dblGallons As Double
Double.TryParse(txtLength.Text, dblLength)
Double.TryParse(txtWidth.Text, dblWidth)
Double.TryParse(txtHeight.Text, dblHeight)
dblVolume = dblLength * dblWidth * dblHeight
dblGallons = dblVolume / 231
lblGallons.Text = dblGallons.ToString("N1")
End Sub
End Class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment