Examlex
Problems - Correcting Logic and Code Errors
The following sample of code contains errors. Rewrite the incorrect statements to correct all errors.
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
' displays type of vehicle for the code entered by user
Const strLENGTH_MSG As String = "The code must contain four characters."
Const strTYPE_MSG As String = "The last character in the code must be C, T, or V."
Dim strCode As String
Dim strLastChar As String
strCode = txtCode.Text.ToLower
' determine whether code contains exactly 4 characters
If strCode.Chars
lblType.Text = String.Empty
MessageBox.Show(strLENGTH_MSG, "Code",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
Else
' determine whether the last character is valid
strLastChar = strCode.Substring(4)
Select Case strCode
Case "C"
lblType.Text = "Car"
Case "T"
lblType.Text = "Truck"
Case "V"
lblType.Text = "Van"
Case Else
lblType.Text = String.Empty
MessageBox.Show(strType_MSG, "Type",
MessageBoxButtons.OK,
MessageBoxIcon.Information)
End If
End If
End Sub
Franchise Contract
A legal agreement granting someone the right to operate a business under the franchisor's brand and business model.
Duress
A situation where a person performs an act as a result of coercion or threat of immediate danger to life or personal safety.
Compromising Photographs
Photographs that could potentially cause embarrassment or harm to the subject if made public.
Support Action
Legal action taken to enforce the provision of financial support, often related to family law matters such as child or spousal support.
Q4: To employ an access key, press and
Q5: Which of the following statements selects all
Q21: You can use a(n) _ to specify
Q21: A meat packer grades meat "P" for
Q29: Because it is possible for an error
Q33: Problems - Correcting Code Errors <br>The following
Q41: An access key allows the user to
Q43: Each object has a set of attributes,
Q59: The way Visual Basic saves changes to
Q292: In a table, the first key is