HomeAboutWeb DesignGraphicDesignPresentationContact

ASP Training 101

Webitcorp : Select Case Statements

Select Case Statments

The CASE statement chooses from a sequence of conditions, and executes a corresponding statement. The CASE statement evaluates a single expression and compares it against several potential values, or evaluates multiple Boolean expressions and chooses the first one that is TRUE.



The Code

<%
Dim Op, value1, value2, EQ

%>
Select Cas Statments

<form method="post" action="select-case-statements.asp">

<input name="box1" type="text" /><br /> <input name="box2" type="text" /><br /> <select name="EQ" size="1">
<option value="Add">Add</option>
<option value="Subtract">Subtract</option>
<option value="Multiply">Multiply</option>
<option value="Divide">Divide</option>

</select>
<input name="Calculate" type="submit" value="Calculate" />

<%

op = Request.Form("EQ")
value1 = Request.Form("box1")
Value2 = Request.Form("box2")

 

select Case op

Case "Add"

Response.Write (cint(value1) + cint(value2))

Case "Subtract"

Response.Write (cint(value1) - cint(value2))

Case "Multiply"

Response.Write( cint(value1) * cint(value2))

Case "Divide"

Response.Write( cint(value1) / cint(value2))

End Select

%>

</form>

Home | About | Web Design | Graphic Design | Presentations | Contact | Site Map | del.icio.us+del.icio.us

| Saint Lucie County, Florida | Rockland County, NY | Burgan County, NJ |


Port Saint Lucie Web Development , Graphic Design , Multimedia Presentations , and much more

Valid XHTML 1.0 Transitional

Copyright ©2007

Onenuttyweb.com