# ■■■■谁知道vb下有好的金额输入控件，就象发票的金额输入部分、会计凭证。。一样

hlm750908 2003-12-12 05:43:40

...全文
39 14 打赏 收藏 举报

14 条回复

johnzzq 2003-12-17

• 打赏
• 举报

hxy2003 2003-12-15
up
• 打赏
• 举报

netbooting 2003-12-14

• 打赏
• 举报

Apple200228 2003-12-13

• 打赏
• 举报

hlm750908 2003-12-13

• 打赏
• 举报

hlm750908 2003-12-13

• 打赏
• 举报

_131_ 2003-12-13

• 打赏
• 举报

hlm750908 2003-12-13

• 打赏
• 举报

hlm750908 2003-12-13

• 打赏
• 举报

ehais 2003-12-13
Number_To_Chinese

• 打赏
• 举报

ehais 2003-12-13

Public Function Number_To_Chinese(ByVal Number As Double) As String
Dim Number_string As String
Dim Dot_pos As Integer
Dim Result_string As String
Dim Is_Zero As Boolean
Dim This_Class_NoNumber As Boolean
Dim Dig_string As String
Dim Integer_Len As Integer, Decimal_Len As Integer
Dim Class_val As Integer

Digit = Array("零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "点")
Digit_Format = Array("", "拾", "佰", "仟")
Class = Array("", "万", "亿", "兆")

Is_Zero = False

Number_string = CStr(Number)
Dot_pos = InStr(Number_string, ".")
If Dot_pos = 0 Then
' 该数为整数
Integer_Len = Len(Number_string)
If Integer_Len Mod 4 = 0 Then
Class_val = Int(Integer_Len / 4) - 1
Else
Class_val = Int(Integer_Len / 4)
End If

For i = 1 To Integer_Len

If (Integer_Len - i - Class_val * 4) = -1 Then
If This_Class_NoNumber = False Then
Result_string = Result_string & Class(Class_val) & Divvy
End If
Class_val = Class_val - 1
Is_Zero = False
This_Class_NoNumber = True
End If
Dig_string = Mid(Number_string, i, 1)
If CInt(Dig_string) = 0 Then

Is_Zero = True
Else
If Is_Zero = True Then
Result_string = Result_string & Digit(0) & Divvy
End If

Result_string = Result_string & Digit(Dig_string) & Divvy
If (Integer_Len - i) Mod 4 <> 0 Then
Result_string = Result_string & Digit_Format(((Integer_Len - i) Mod 4)) & Divvy
End If
Is_Zero = False
This_Class_NoNumber = False
End If

Next
Else
' 该处为整数部分
Integer_Len = Dot_pos - 1
If Integer_Len Mod 4 = 0 Then
Class_val = Int(Integer_Len / 4) - 1
Else
Class_val = Int(Integer_Len / 4)
End If

For i = 1 To Integer_Len

If (Integer_Len - i - Class_val * 4) = -1 Then
If This_Class_NoNumber = False Then
Result_string = Result_string & Class(Class_val) & Divvy
End If
Class_val = Class_val - 1
Is_Zero = False
This_Class_NoNumber = True
End If
Dig_string = Mid(Number_string, i, 1)
If CInt(Dig_string) = 0 Then
Is_Zero = True
Else
If Is_Zero = True Then
Result_string = Result_string & Digit(0) & Divvy
End If

Result_string = Result_string & Digit(Dig_string) & Divvy
If (Integer_Len - i) Mod 4 <> 0 Then
Result_string = Result_string & Digit_Format(((Integer_Len - i) Mod 4)) & Divvy
End If
Is_Zero = False
This_Class_NoNumber = False
End If

Next

If Integer_Len = 0 Then '纯小数
Result_string = Result_string & Digit(0) & Divvy
End If

Result_string = Result_string & Digit(10) & Divvy
' 该处为小数部分
For i = Dot_pos + 1 To Len(Number_string)
Result_string = Result_string & Digit(Mid(Number_string, i, 1)) & Divvy
Next

End If
Number_To_Chinese = Result_string
End Function
• 打赏
• 举报

hlm750908 2003-12-13

2ego@163.com
• 打赏
• 举报

sanwaxubin 2003-12-12

• 打赏
• 举报

hlm750908 2003-12-12

2ego@sohu.com
2ego@163.com
xhego@126.com
• 打赏
• 举报

1433

VB 控件

2003-12-12 05:43