If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Sub Display doesn't work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-28-04, 14:15
Jane2004 Jane2004 is offline
Registered User
 
Join Date: Feb 2004
Posts: 7
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
Reply With Quote
  #2 (permalink)  
Old 02-28-04, 14:43
Jane2004 Jane2004 is offline
Registered User
 
Join Date: Feb 2004
Posts: 7
Re: Sub Display doesn't work

I figured it out. Disregard this post!
Reply With Quote
  #3 (permalink)  
Old 03-02-04, 10:01
accarvajal accarvajal is offline
Registered User
 
Join Date: Feb 2004
Location: Cali - Colombia
Posts: 16
Re:

Which VB version are you working?
__________________
A.C.C.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On