1

我正在努力寻找解决方案。我目前正在尝试接受像 01 这样的输入并通过程序保持这种方式,但是 VB.net 似乎将其格式化为 1。有没有办法阻止它这样做?

提前谢谢你,如果这只是我的愚蠢,我很抱歉。

4

1 回答 1

2

If you want to keep it as "01" , you should store it in a string format not integer or any numerical data type. If you must use integers , you can display the output only in the format you want like this :

Dim int As Integer = 1
Console.Writeline(Format(int, "00"))

This should give you the output in the desired format. I hope that was helpful for you.

于 2013-04-11T00:30:43.340 回答