Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    7

    Unanswered: Sub Display doesn't work

    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
    Join Date
    Feb 2004
    Posts
    7

    Re: Sub Display doesn't work

    I figured it out. Disregard this post!

  3. #3
    Join Date
    Feb 2004
    Location
    Cali - Colombia
    Posts
    16

    Re:

    Which VB version are you working?
    A.C.C.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •