|
-
Feb 28th, 2004, 01:37 PM
#1
Thread Starter
New Member
Display Sub not working correctly?!
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
-
Feb 28th, 2004, 02:41 PM
#2
Thread Starter
New Member
I figured it out. Disregard this post!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|