|
| |
|
|
furious_mango
Posts: 1 Joined: 5/20/2009 Status: offline
|
help with basic if then else - 5/20/2009 23:43:55
hi I'm a total noob with coding and expression web. it's not my major and I haven't done any programming before. Sitting in the lab at the moment and staring blankly at this question: 1. Create a new page called tutorial_form.aspx 2. Insert a new textbox and a button that asks a user to enter a number between 0 and 100. 3. Add code so that only during a postback if the user entered a number below 0 it outputs, “You are naughty, your number was below 0”, if the number was above 100 it outputs “Tsk Tsk. I told you to enter a number below 100”, otherwise it outputs “Thank you for following instructions. [the number] is between 0 and 100”. Note: You will need to convert the input from a String to an Integer and you will need to nested IF statements! Can someone help please? edit: i know how to add the textbox and the button. I'm just not sure about the coding: what am i doing wrong here: <script runat="server"> Sub Page_Load(ByVal sender as Object, ByVal E as EventArgs) dim number as integer If number <=0 Then response.Write "You are naughty, your number was below 0" else If number >=100 Then response.Write "Tsk Tsk. i told you to enter a number below 100" else response.Write "Thank you for following instructions. (numberbox.Text) is between 0 and 100" end If end sub </script>
|
|
|
|
swoosh
Posts: 1535 Joined: 5/18/2002 From: Beaver Falls, PA Status: offline
|
RE: help with basic if then else - 5/27/2009 16:29:32
I believe your missing assigning the variable number to the actual textbox in your code number = numberbox.text
_____________________________
Swoooosh Just Do It!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|