您的位置:逆风者 VB 正文
原作者:www.upwinder.com 添加时间:2007-09-01 原文发表:2007-08-31 人气:66 来源:未知

Public Function ZDX(X As Currency) As String
Dim lnP As Integer
Dim Prc As String
Dim Tmp As String
Dim NoB As Currency
Dim Dx As String
Dim Xx As String
Dim Zhen As Boolean
逆风者
Dim Str(10) As String
Dim China As String
China = "分角元拾佰仟万拾佰仟亿"
Str(0) = "零"
Str(1) = "壹"
Str(2) = "贰"
Str(3) = "叁"
Str(4) = "肆"
Str(5) = "伍"
Str(6) = "陆"
Str(7) = "柒"
Str(8) = "捌"
Str(9) = "玖"

Zhen = True
X = FormatNumber(X, 2)
Prc = CStr(X)
Prc = Replace(Prc, ",", "")

lnP = Len(Prc)
For i = lnP - 1 To 1 Step -1
If Mid(Prc, i, 1) = "." Then
Select Case lnP - i
Case 1
Prc = Replace(Prc, ".", "") "0"
Case 2
Prc = Replace(Prc, ".", "")
End Select
Zhen = False
Exit For
End If
Next i
If Zhen Then Prc = Prc "00"
lnP = Len(Prc)
For i = 1 To lnP
Tmp = Str(Mid(Prc, i, 1)) & Tmp
Next i

ZDX = ""
fy = 1
For i = 1 To lnP
Xx = Mid(Tmp, i, 1)
Dx = Mid(China, i, 1)

If Xx <> "零" Then
ZDX = Xx & Dx & ZDX
f = 1
Else
If i = 3 Then
ZDX = Dx & ZDX
End If

If i = 7 Then
ZDX = Dx & ZDX
End If
If f Then
ZDX = "零" & ZDX
End If
f = 0
End If
Next i
If Zhen Then ZDX = ZDX "正"
ZDX = Replace(ZDX, "零万", "万")
ZDX = Replace(ZDX, "零元", "元")

End Function

相关文章

Visual Basic程序设计
读写INI文件的四个函数
获得MouseLeave的方法
Visual Basic CommandButton 控件
用VB开发即时战略游戏
如何交换鼠标按键
再谈VB程序的加密
VB 神童教程第三章第二节——综合示例六
Visual Basic编程访问WMI对象
VB 神童教程第二章第十二节——综合示例五
VB编程的一些基础的问题
自己的邮件自己发
第一个 Visual Basic 应用程序
Visual Basic COM基础讲座之事件
Visual Basic 概述
VB教程 第二章:控件学习
大小写互换的三种方法
VB常用术语释义
DataGrid 控件的使用
获得、设置鼠标双击间隔时间

相关评论


本文章所属分类:首页 VB

  热门关键字: