Sams Teach Yourself ASP.NET in 21 Days, Second Edition By Chris Payne
Table of Contents
Day 3. Using Visual Basic.NET and C#
This workshop will help reinforce the concepts covered in today's lesson. The answers can be found in Appendix A.
Quiz
1:
When should you use a for loop? A while loop?
2:
What is the output of the following code snippet?
Dim I as integer = 5 Do Response.Write(I & " ") I = I + 2 Loop Until I > 10
3:
What is the output of the following code snippet?
Dim I as integer = 5 Do I = I + 2 Response.Write(I & " ") Loop Until I > 10
4:
What are the standard event handler parameters for ASP.NET pages?
Exercises
[click here]
Create an ASP.NET page with a class that represents you, with properties that describe your hair color, eye color, and birth date. Use the DayOfWeek property of the DateTime data type to determine the day of the week of your birthday. The DayOfWeek property returns an value from the DayOfWeek enumeration convert this into a string representing the day. Call this method whenever a user clicks the Submit button, and print the output to the browser.
Hint: You'll need to use the new keyword with the DateTime data type. Pass three parameters into the new DateTime data type: the year, month, and day of month, in that order. For example:
dim MyDate as new DateTime(2002,1,1) 'January 1, 2002