[英]Character limit on typing/pasting hex into numericupdown
Im trying to build a winform at the moment. 我正在尝试建立一个winform。 I need a box to enter a hexidecimal byte offset (ie should be capable of holding a 64 bit number).
我需要一个框来输入十六进制字节偏移量(即应该能够容纳64位数字)。
I had thought a numericupdown would work but it seems to have a 32 bit limit. 我曾以为numericupdown可以工作,但似乎有32位限制。 Is there a way around this or a more suitable approach somebody could suggest?
有没有办法解决这个问题,或者有人可以建议一种更合适的方法?
Update: 更新:
The 32 bit (8 character) limit refers to typing/pasting a value into the box. 32位(8个字符)的限制是指在框中键入/粘贴一个值。
NumericUpDown.Value is a decimal NumericUpDown.Value是一个十进制
http://msdn.microsoft.com/en-us/library/364x0z75.aspx http://msdn.microsoft.com/en-us/library/364x0z75.aspx
10^28 is about 2^100 (so 100 bits for mantissa) so 64 bits are ok 10 ^ 28大约是2 ^ 100(所以尾数为100位),所以可以使用64位
If you try this piece of code on a just created numericupdown works fine... 如果您在刚刚创建的numericupdown上尝试这段代码,则效果很好...
numericUpDown1.Maximum = UInt64.MaxValue;
numericUpDown1.Value = numericUpDown1.Maximum;
EDIT: if you set the flag for hex you can't use UInt64 but only Int64. 编辑:如果将标志设置为十六进制,则不能使用UInt64,而只能使用Int64。 I missed it... Anyway, Int64 is ok.
我错过了...无论如何,Int64还可以。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.