Results 1 to 2 of 2

Thread: Display Sub not working correctly?!

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2

    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

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2004
    Posts
    2
    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
  •  



Click Here to Expand Forum to Full Width