Hi!
I have a sub procedure that needs to display the number preceded by the string as a message in a message box. However, it doesn't display the result.
Any ideas??
Here is the coding so far:
Private Sub btnfactor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnfactor.Click
Dim number As Integer
Dim InValue As String
Dim result As String
InValue = txtvalue.Text
If (IsNumeric(InValue)) Then
If CInt(InValue) < 0 Or CInt(InValue) > 12 Then
lbldisplay.Text = "Input number is out of range!"
Else
result = Factorial(CInt(InValue))
Display(result)
End If
Else : lbldisplay.Text = "Input number is not numeric!"
End If
End Sub
Function Factorial(ByVal number As Integer) As Integer
If number <= 1 Then
Return 1
Else
Return (number * Factorial(number - 1))
End If
End Function
Private Overloads Sub Display(ByVal Number() As Integer, ByVal Message As String)
Dim DoDisplay As String = ""
Dim ctr As Integer
For ctr = 0 To Number.GetUpperBound(0)
DoDisplay &= Number(ctr) & vbCrLf
Next
MsgBox(DoDisplay)
End Sub