Ti metto una mia vecchia funzione:
codice:Piu4000: num = num + 1 4000: If num < 1000 Then GoTo 900 If num > 1000 Then DecToRom = DecToRom & "M" num = num - 1000 GoTo 4000 End If 900: If num < 500 Then GoTo 400 If num > 900 Then DecToRom = DecToRom & "CM" num = num - 900 GoTo 900 ElseIf num > 800 Then DecToRom = DecToRom & "DCCC" num = num - 800 GoTo 900 ElseIf num > 700 Then DecToRom = DecToRom & "DCC" num = num - 700 GoTo 900 ElseIf num > 600 Then DecToRom = DecToRom & "DC" num = num - 600 GoTo 900 ElseIf num > 500 Then DecToRom = DecToRom & "D" num = num - 500 GoTo 900 End If 400: If num < 100 Then GoTo 90 If num > 400 Then DecToRom = DecToRom & "CD" num = num - 400 GoTo 400 ElseIf num > 300 Then DecToRom = DecToRom & "CCC" num = num - 300 GoTo 400 ElseIf num > 200 Then DecToRom = DecToRom & "CC" num = num - 200 GoTo 400 ElseIf num > 100 Then DecToRom = DecToRom & "C" num = num - 100 GoTo 400 End If 90: If num < 50 Then GoTo 40 If num > 90 Then DecToRom = DecToRom & "XC" num = num - 90 GoTo 90 ElseIf num > 80 Then DecToRom = DecToRom & "LXXX" num = num - 80 GoTo 90 ElseIf num > 70 Then DecToRom = DecToRom & "LXX" num = num - 70 GoTo 90 ElseIf num > 60 Then DecToRom = DecToRom & "LX" num = num - 60 GoTo 90 ElseIf num > 50 Then DecToRom = DecToRom & "L" num = num - 50 GoTo 90 End If 40: If num < 10 Then GoTo 9 If num > 40 Then DecToRom = DecToRom & "XL" num = num - 40 GoTo 40 ElseIf num > 30 Then DecToRom = DecToRom & "XXX" num = num - 30 GoTo 40 ElseIf num > 20 Then DecToRom = DecToRom & "XX" num = num - 20 GoTo 40 ElseIf num > 10 Then DecToRom = DecToRom & "X" num = num - 10 GoTo 40 End If 9: If num < 5 Then GoTo 4 If num > 9 Then DecToRom = DecToRom & "IX" num = num - 9 GoTo 9 ElseIf num > 8 Then DecToRom = DecToRom & "VIII" num = num - 8 GoTo 9 ElseIf num > 7 Then DecToRom = DecToRom & "VII" num = num - 7 GoTo 9 ElseIf num > 6 Then DecToRom = DecToRom & "VI" num = num - 6 GoTo 9 ElseIf num > 5 Then DecToRom = DecToRom & "V" num = num - 5 GoTo 9 End If 4: If num < 1 Then GoTo Fine If num > 4 Then DecToRom = DecToRom & "IV" num = num - 4 GoTo 4 ElseIf num > 3 Then DecToRom = DecToRom & "III" num = num - 3 GoTo 4 ElseIf num > 2 Then DecToRom = DecToRom & "II" num = num - 2 GoTo 4 ElseIf num > 1 Then DecToRom = DecToRom & "I" num = num - 1 GoTo 4 End If Fine: Form1.Text2 = DecToRom![]()

Rispondi quotando