Função para validar NISS, com base nos critérios deste documento (NISS.pdf)
Function IsValidNISS(ByVal NISS As String) As Boolean If Len(NISS) = 11 Then Dim factor() As Integer = {29, 23, 19, 17, 13, 11, 7, 5, 3, 2} Dim t As Integer = Int32.Parse(GetChar(NISS, 1)) * factor(0) + _ Int32.Parse(GetChar(NISS, 2)) * factor(1) + _ Int32.Parse(GetChar(NISS, 3)) * factor(2) + _ Int32.Parse(GetChar(NISS, 4)) * factor(3) + _ Int32.Parse(GetChar(NISS, 5)) * factor(4) + _ Int32.Parse(GetChar(NISS, 6)) * factor(5) + _ Int32.Parse(GetChar(NISS, 7)) * factor(6) + _ Int32.Parse(GetChar(NISS, 8)) * factor(7) + _ Int32.Parse(GetChar(NISS, 9)) * factor(8) + _ Int32.Parse(GetChar(NISS, 10)) * factor(9) Dim x As Integer = (9 - (Math.IEEERemainder(t, 10))) If x.ToString = GetChar(NISS, 11) Then Return True Else Return False End If Else Return False End If End Function