ASP.NET Events Function FormatDateTime
A. Add a Web Form called Events
B. Place a button and label.
1. Code the button click event to set the label to “Hello World”.
2. Change the name of the button event procedure but not the handles clause.
3. Run again to prove it still works
4. Screen print
C. Place a dropdown list on the form
1. Populate the list with 10 names of stores from a sub procedure called from Page_Load:
a) Use Dim lstStores() = {x,x,x} followed with datasource,databind
b) This should run once …not on postback
2. Code the appropriate list event so that when an item is selected on the list the label says “I shop at “….. store that was selected
a) Run this a number of times….the list should stay the same…not grow
3. Screen Print it works
D. Place three radio buttons on the form
1. Label each with a different color, rbtRed, rbtGreen, rbtBlue
a) Assign a group name “Colors”
2. In a one event procedure code to set the label to “You clicked on “ color selected.
E. Turn Option Strict On
1. Add a button btnStrict
2. In the click event set the btnStrict.Text = 21
F. Add another Button: Text = Show Me The Date
2. Use at least two methods to do this
a) Hint… Format and FormatDateTime
3. Add a Class module called TaxClass
A. Create a property call TaxRate that accepts a value of type single
1. Assign it to a private internal working variable msngTaxRate.
B. Add a Function called CalcTax
1. That accepts a value called Amount, type single, returns a single
2. In the function calculate the tax on the Amount based upon the TaxRate
C. On the Events form place a button labeled CalcTax
1. On the Click event create an instanced of the class
2. Set the tax rate to .0775
3. Call the CalcTax method passing 10,000.00
4. Display the amount of tax in the Text property of the button.
5. Format as currency (you can not concatenate the $)
4. In TaxClass add a Shared Public Function called ShowMeTheMoney
A. Accepts a String (Name) and Double (Amount) and returns a string
1. Return “name made amount this month” and amount must be formatted with $ using the String.Format function.
B. On Events Form add a button with Text = Show Me The Money?
1. In the click event, in one line of code, change the text of the button to the string created in the ShowMeTheMoney function in the TaxClass.
2. The Amount should be formatted with $ and commas.
5. Screen running prints to prove it works and print
A. Be sure to print the class module code.
6. Add a link button called lnkDelete
A. Place code in your page initialize to add the onClick javascript confirm message box to the button.
1. btnDelete.Attributes.Add("onClick", "return confirm(' Click OK to Confirm Delete ')")
B. If the user clicks OK then set button label to “You Deleted This Item.”
C. File . Print all code.
7. Add a new Web Form called Validation
A. Create a data input form in a 2 column table with the following labels and text boxes
1. Full name: Input required
2. Address: Input required…BUT default text is “Enter Address Here”
3. Start Date: Input Required AND
a) Must be older than 1 and less than 30 years ago relative to today.
b) Place correct code in Page_Load and PRINT out this code
c) (this is coved in the book)
4. End Date: Any proper format date. (Hints; compare & operator)
5. Telephone: Input Required & Proper Format
6. Submit Button
B. Response.Write a thank you in Page Load if the postback works
C. Print once showing it all works
D. Modify by changing “in line” messages to * and inserting a summary control with all the error messages.
E. Print showing the new error messages at the bottom.
B. Place a button and label.
1. Code the button click event to set the label to “Hello World”.
2. Change the name of the button event procedure but not the handles clause.
3. Run again to prove it still works
4. Screen print
C. Place a dropdown list on the form
1. Populate the list with 10 names of stores from a sub procedure called from Page_Load:
a) Use Dim lstStores() = {x,x,x} followed with datasource,databind
b) This should run once …not on postback
2. Code the appropriate list event so that when an item is selected on the list the label says “I shop at “….. store that was selected
a) Run this a number of times….the list should stay the same…not grow
3. Screen Print it works
D. Place three radio buttons on the form
1. Label each with a different color, rbtRed, rbtGreen, rbtBlue
a) Assign a group name “Colors”
2. In a one event procedure code to set the label to “You clicked on “ color selected.
E. Turn Option Strict On
1. Add a button btnStrict
2. In the click event set the btnStrict.Text = 21
F. Add another Button: Text = Show Me The Date
2. Use at least two methods to do this
a) Hint… Format and FormatDateTime
3. Add a Class module called TaxClass
A. Create a property call TaxRate that accepts a value of type single
1. Assign it to a private internal working variable msngTaxRate.
B. Add a Function called CalcTax
1. That accepts a value called Amount, type single, returns a single
2. In the function calculate the tax on the Amount based upon the TaxRate
C. On the Events form place a button labeled CalcTax
1. On the Click event create an instanced of the class
2. Set the tax rate to .0775
3. Call the CalcTax method passing 10,000.00
4. Display the amount of tax in the Text property of the button.
5. Format as currency (you can not concatenate the $)
4. In TaxClass add a Shared Public Function called ShowMeTheMoney
A. Accepts a String (Name) and Double (Amount) and returns a string
1. Return “name made amount this month” and amount must be formatted with $ using the String.Format function.
B. On Events Form add a button with Text = Show Me The Money?
1. In the click event, in one line of code, change the text of the button to the string created in the ShowMeTheMoney function in the TaxClass.
2. The Amount should be formatted with $ and commas.
5. Screen running prints to prove it works and print
A. Be sure to print the class module code.
6. Add a link button called lnkDelete
A. Place code in your page initialize to add the onClick javascript confirm message box to the button.
1. btnDelete.Attributes.Add("onClick", "return confirm(' Click OK to Confirm Delete ')")
B. If the user clicks OK then set button label to “You Deleted This Item.”
C. File . Print all code.
7. Add a new Web Form called Validation
A. Create a data input form in a 2 column table with the following labels and text boxes
1. Full name: Input required
2. Address: Input required…BUT default text is “Enter Address Here”
3. Start Date: Input Required AND
a) Must be older than 1 and less than 30 years ago relative to today.
b) Place correct code in Page_Load and PRINT out this code
c) (this is coved in the book)
4. End Date: Any proper format date. (Hints; compare & operator)
5. Telephone: Input Required & Proper Format
6. Submit Button
B. Response.Write a thank you in Page Load if the postback works
C. Print once showing it all works
D. Modify by changing “in line” messages to * and inserting a summary control with all the error messages.
E. Print showing the new error messages at the bottom.
<< Home