Thread: NaN
View Single Post
  #1 (permalink)  
Old August 4th, 2007, 04:46 AM
spinout spinout is offline
Authorized User
 
Join Date: Sep 2004
Location: Sydney, NSW, Australia.
Posts: 67
Thanks: 1
Thanked 0 Times in 0 Posts
Default NaN

Hello Everyone.

Does anyone know how I can check for NaN? I have this function which works well, except for when Votes and TotalVotes are both equal to 0.

Code:
Public Function CalculatePercentage(ByVal Votes As Integer, ByVal TotalVotes As Integer)
  Dim Calculate
  Calculate = Math.Round(Votes / TotalVotes * 100)
  Calculate = Convert.ToInt32(Calculate)
  Return Calculate
End Function
Reply With Quote