63.txt
来自「VB文章集(含API、窗口、数据库、多媒体、系统、文件、等等)」· 文本 代码 · 共 21 行
TXT
21 行
一个Format函数
A new Format function
Visual Basic 5 has the Format command that almost works the same as Print. The difference is that Format shortens the output string length if all the format characters are not used. To work around this I wrote a Public Function called FormatNum.
Public Function FormatNum(MyNumber As Double, FormatStr As String) As String
注释: This Function returns number formatted as a string
注释: with the desired minimum number of characters
注释: MyNumber - Use CDbl(MyNumber) in the function
注释: call to prevent type mismatch error.
注释:
FormatNum = Format$(MyNumber, FormatStr)
If Len(FormatNum) < Len(FormatStr) Then
FormatNum = Space$(Len(FormatStr) - Len(FormatNum)) & FormatNum
End If
End Function
Use this function like this:
Print #FileNumber, FormatNum(CDbl(MyVariable), " #### ")
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?