Получение сообщения, в котором говорится: «Параметр строго по запрету запрещает неявные преобразования из« String »в« Integer »». - PullRequest
0 голосов
/ 28 ноября 2018

Я новичок в мире программирования, и я столкнулся с ошибкой, которую я еще не видел, которая гласит: «Строгое значение Option запрещает неявные преобразования из« String »в« Integer »».Я дословно следовал своему учебнику, и все кажется правильным, но я все еще получаю это сообщение.Было бы очень признательно, если бы кто-нибудь помог мне понять, что происходит немного лучше.

Private Sub BtnDiveCost_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDiveCost.Click
    ' This event determines the cost and displays the size of the dive team, the cost, and the lenght of the dive

    Dim intTeamSize As Integer
    Dim blnNumberInTeamIsValid As Boolean = False
    Dim blnDiveIsSelected As Boolean = False
    Dim intDiveChoice As Integer
    Dim strSelectedTeam As String = ""
    Dim intLocationChoice As Integer
    Dim intLength As Integer = 0
    Dim decTotalCost As Decimal

    ' Calls a function to ensure the number of people in the dive team is valid
    blnNumberInTeamIsValid = ValidateNumberInTeam()
    ' Call a function to ensure a scuba dive was selected
    intDiveChoice = ValidateDiveSelection(blnDiveIsSelected, strSelectedTeam) '<-- Error occurs here.

    ' If Number Of people And the dive trip are valid, calculate the cost
    If (blnNumberInTeamIsValid And blnDiveIsSelected) Then
        intTeamSize = Convert.ToInt32(TxtTeam.Text)
        intLocationChoice = CboLocation.SelectedIndex
        Select Case intLocationChoice
            Case 0
                decTotalCost = AustraliaDiveCost(intDiveChoice, intTeamSize, intLength)
            Case 1
                decTotalCost = BelizeDiveCost(intDiveChoice, intTeamSize, intLength)
            Case 2
                decTotalCost = FijiDiveCost(intDiveChoice, intTeamSize, intLength)
        End Select
        ' Display cost of the scuba dive
        LblScubaDive.Text = "Dive: " & strSelectedTeam
        LblCost.Text = "Cost: " & decTotalCost.ToString("C")
        LblLength.Text = "Length: " & intLength.ToString() & "hours"
    End If
End Sub
...