The C# provided TextBox provides for universality. Here we modify the functionality to use only numbers, Integers (to base 2, 4, 8, 10 and 16) or Decimals or Double/Floats. The Integer version will be expanded as an IP address entry helper.
Pure Integer numbers are dealt with here, with the text display in one of 5 different base (2, 4, 8, 10 or 16). having choosen the base the possible entry text is limited to that supported by the base, so base binary will only allow 0 or 1 whereas base hexadecimal allows 0 to 9, A to F, base octal 0 to 7 and base nibble 0 to 3. However both the internal and external numerical values are always Int32.
The range can be limited by specifying a maximum and / or minimum value. Using this for IPv4 entry the range would be 0-255.
Decimal is held in a 64 bit frame, with an integer and decimal parts. The decimal seperator is that of the "CurrentCulture", if this is undesirable then use the CultureInvariant option or remove culture references and define user specific seperators for the decimal and groups.
The range can be limited by specifying a maximum and / or minimum value, otherwise this is set to the Decimal range limits.
Double is held in a 32 bit frame. The float is the same as a Double internally, only the external presentation changes. The decimal seperator is that of the "CurrentCulture", if this is undesirable then use the CultureInvariant option or remove culture references and define user specific seperators for the decimal and groups.
The range can be limited by specifying a maximum and / or minimum value, otherwise this is set to the Double range limits. Any float usage will be rounded from the internal Double data.