That is because the only way the code for that MessageBox will ever execute is if the
strUserInput is empty. You currently have it in the Else portion of an IF statement. So only one or the other set of statements will execute depending on the resulting condition of the IF statement.
I think what you mean to do is this:
CODE
Dim strUserInput
Dim IntUserInput As Integer
Dim i As Integer
strUserInput = InputBox("Enter a positive integer value", "Input Needed", 10)
If strUserInput <> String.Empty Then
Try
intUserInput = CInt(strUserInput)
If IntUserInput < 0 Then
MessageBox.Show("Negative numbers are not accepted.")
Exit Sub
End If
'IntUserInput = (IntUserInput + i)
MessageBox.Show("Sum of Numbers", "The sum of numbers" & (i + IntUserInput), MessageBoxButtons.OK)
Catch ex As Exception
MessageBox.Show("Quantity amount must be numeric.")
End Try
'Show messagebox,
Else
MessageBox.Show("Incorrect input", "You must enter a positive integer value", MessageBoxButtons.OK)
Exit Sub
End If
You are still missing one important element in order for you to correctly sum up the numbers. You will need a loop to go through all the numbers adding them up as it goes along keeping a running total.