Factorial Calculate

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2004
Posts: 1
Reputation: deepsmehta is an unknown quantity at this point 
Solved Threads: 0
deepsmehta deepsmehta is offline Offline
Newbie Poster

Factorial Calculate

 
0
  #1
Sep 10th, 2004
I want to calculate factorial with all proper validations. Can anyone tell me the functions to be use for this using VB.NET...pLz
Reply With Quote Quick reply to this message  
Join Date: Dec 2007
Posts: 66
Reputation: manutd4life is an unknown quantity at this point 
Solved Threads: 1
manutd4life manutd4life is offline Offline
Junior Poster in Training

Re: Factorial Calculate

 
0
  #2
Sep 1st, 2008
i use procedures

u have to rename some words in these code as it is my code
like (txtfirstnum.text = ur text box ) (txtanswer.text= ur answer box) thats all i think

VALIDATION

  1. Public Sub validation()
  2. If txtFirstNum.Text = "" Then
  3. MsgBox("First Number is Empty")
  4. ElseIf Not IsNumeric(txtFirstNum.Text) Then
  5. MsgBox("First Number is not numeric")
  6. Else
  7. call factorial
  8. endif
  9. endsub

FACTORIAL

  1. Public Sub factorial()
  2. Dim counter As Integer
  3. Dim result As Long
  4. Dim x As String = (Val(txtFirstNum.Text))
  5. counter = 1
  6. result = 1
  7. While counter <= x
  8. result = result * counter
  9.  
  10. counter = counter + 1
  11.  
  12. txtAnswer.Text = result
  13. End While
  14. End Sub


of course u have to call it in ur command button code
  1. Private sub cmdcalculate_click(.)
  2. call validation
  3. endsub

am still a beginner thats all i can help u any problems contact another members

Remember with other members u'll have to try something first
without effort they will not help u
hope this help
Last edited by manutd4life; Sep 1st, 2008 at 4:44 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC