Link to rubric and code. This is for chapter 9 as I am trying to provide as much details as possible:
https://1drv.ms/u/s!AnJ4ilz1MKZlga4rg7cPsTPereF_8g?e=3acLyL
' Hi, I'm trying to create a web form using Microsoft Visual Studio. Under the comment, "Ensure a Taco Selection is Selected," what is the proper code to validate that a drop-down list has been selected? I have not yet begun validating that a check box has been selected. Would they use the same method of code? If not, how can I validate that a check box has been selected?
' I have tried to use the standard If-Then or If-Else statements but I keep receiving error messages.
' I apologize for mixing my question with the code, as I am not sure how to keep them separate
' Project: Street Tacos Order Form ' Author: Richard Lew ' Date: November 3, 2019 ' Purpose: The web application allows a customer to fill out a street taco order form.
Public Class About Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
End Sub
Protected Sub btnSubmit_Click(sender As Object, e As EventArgs) Handles btnSubmit.Click
' The btnSubmit click event will calculate the cost of the street tacos
' based on the type of tacos selected.
' Declare and initialize variables
Dim decChickenCost As Decimal = 8.99D
Dim decPorkCost As Decimal = 9.99D
Dim decFishCost As Decimal = 12.99D
Dim decBeefCost As Decimal = 13.99D
Dim decExtraCost As Decimal = 0.99
Dim strName As String
Dim strAddress As String
Dim strPhone As String
Dim decOrderCost As Decimal = 0D
Dim strMessage As String
' Trim additional spaces that are entered by the user
strName = txtName.Text.Trim
strAddress = txtAddress.Text.Trim
strPhone = txtPhone.Text.Trim
' Clear the Order Message
lblOrder.Text = ""
' Ensure a Taco Selection is Selected
If (ddlTacoType.SelectedIndex == 0) Then
{ {
lblTacoTypeError.Visible = True
}
End If
End Sub
End Class
' The code should prompt the user to select a taco from the drop-down menu and to select at least one check box.
Aucun commentaire:
Enregistrer un commentaire