You'd normally use a Structure to do this. Something like this:
<debuggerdisplay("{m_value}")>
Public Structure CustomValueType
Private m_Value As Integer
Public Shared ReadOnly MinValue = New CustomValueType With {.m_Value = -100}
Public Shared ReadOnly MaxValue = New CustomValueType With {.m_Value = 100}
Private Sub New(ByVal value As Integer)
If value < CustomValueType.MinValue Then
Throw New ArgumentOutOfRangeException("value", "Value cannot be less than CustomValueType.MinValue.")
End If
If value > CustomValueType.MaxValue Then
Throw New ArgumentOutOfRangeException("value", "Value cannot be greater than CustomValueType.MaxValue.")
End If
m_Value = value
End Sub
Public Shared Widening Operator CType(ByVal value As CustomValueType) As Integer
Return value.m_Value
End Operator
Public Shared Narrowing Operator CType(ByVal value As Integer) As CustomValueType
Return New CustomValueType(value)
End Operator
Public Shared Operator <(ByVal x As CustomValueType, ByVal y As CustomValueType) As Boolean
Return x.m_Value < y.m_Value
End Operator
Public Shared Operator >(ByVal x As CustomValueType, ByVal y As CustomValueType) As Boolean
Return x.m_Value > y.m_Value
End Operator
Public Shared Operator <(ByVal x As Integer, ByVal y As CustomValueType) As Boolean
Return x < y.m_Value
End Operator
Public Shared Operator >(ByVal x As Integer, ByVal y As CustomValueType) As Boolean
Return x > y.m_Value
End Operator
End Structure
It's used just like you want:
Sub Main()
Dim x As CustomValueType
x = 31
x = 110
End Sub
The problem with creating your own value type like this is that you have to define a ton of Operators for your type. Notice, my example is only implementing implicit conversions between an Integer and the CustomValueType and the < and > operators. You still have to define =, <>, >=, <=, +, -, *, /, and some other conversions, but only if they make sense for your implementation.