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