dimanche 22 novembre 2015

loop function is not working right

I am trying to create a loop that takes individual scores inputted via input box... the loop checks to see if user enters a valid numeric value and displays a error msg if the wrong value inputted. The loop also displays each player score and a running total in a list box item.

My loop is exiting to early and is not functioning right... I can't seem to find out why:

DimstrBowlingScores AsString

DimintBowlingScores AsInteger

DimintScoreTally AsInteger

DimstrInputMessage = "Enter the Frame score for player #: "

DimstrInputHeading = "Frame Score "

DimstrNormalMessage = "Enter the Frame score for player #: "

DimstrNonNumericmMessage = "Error-Please enter a numeric value for team player #: "

DimstrNegativeMessage = "Error-Please enter a positive number for player #"

DimstrCanceled = ""

DimintMaxNumberOfEntries = 15

DimintPlayerNumber = 1

DimstrTotalScores AsString= " Total Score "

strBowlingScores = InputBox(strInputMessage & intPlayerNumber, strInputHeading, "")

'intBowlingScores = Convert.ToInt16(strBowlingScores)

'intScoreTally = intBowlingScores

DoUntilintPlayerNumber < intMaxNumberOfEntries OrstrCanceled = ""

IfIsNumeric(strBowlingScores) Then

intBowlingScores = Convert.ToInt32(strBowlingScores)

intScoreTally = intBowlingScores 

IfintBowlingScores > 0 Then

lstBowlerScores.Items.Add(strInputHeading & intBowlingScores.ToString & strTotalScores & intScoreTally.ToString) 

intPlayerNumber += 1

intScoreTally += intBowlingScores 

strInputMessage = strNormalMessage

Else

strInputMessage = strNegativeMessage 

EndIf

Else

strInputMessage = strNonNumericmMessage 

EndIf

IfintPlayerNumber <= intMaxNumberOfEntries Then

strBowlingScores = InputBox(strInputMessage & intPlayerNumber, strInputHeading, "")

EndIf

Loop

Aucun commentaire:

Enregistrer un commentaire