Public Function RomanNumber(ByVal Number As UShort) As String
 ' Algorithm to convert an integer to a roman number
 ' Works for values 1 and above
 ' Example: RomanNumber(12) = "XII"
 '
 ' Visustin sample algorithm
 ' ©2006 Aivosto Oy (www.aivosto.com)

 Dim Roman As String = ""
 Do While Number > 0
  Select Case Number
   Case Is >= 1000
    Roman &= "M"
    Number -= 1000
   Case Is >= 900
    Roman &= "CM"
    Number -= 900
   Case Is >= 500
    Roman &= "D"
    Number -= 500
   Case Is >= 400
    Roman &= "CD"
    Number -= 400
   Case Is >= 100
    Roman &= "C"
    Number -= 100
   Case Is >= 90
    Roman &= "XC"
    Number -= 90
   Case Is >= 50
    Roman &= "L"
    Number -= 50
   Case Is >= 40
    Roman &= "XL"
    Number -= 40
   Case Is >= 10
    Roman &= "X"
    Number -= 10
   Case 9
    Roman &= "IX"
    Number -= 9
   Case 5 To 8
    Roman &= "V"
    Number -= 5
   Case 4
    Roman &= "IV"
    Number -= 4
   Case 1 To 3
    Roman &= "I"
    Number -= 1
  End Select
 Loop
 Return Roman
End Function