请教各位! 小弟初学!在VB中怎样把数字转换为货币!如:把123.56显示为壹佰贰拾叁元伍角陆分! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 dim chap(21, 1)初始化: chap(0, 0) = "万": chap(0, 1) = 10000 chap(1, 0) = "仟": chap(1, 1) = 1000 chap(2, 0) = "佰": chap(2, 1) = 100 chap(3, 0) = "拾": chap(3, 1) = 10 chap(4, 0) = "元": chap(4, 1) = 1 chap(5, 0) = "角": chap(5, 1) = 0.1 chap(6, 0) = "分": chap(6, 1) = 0.01 chap(11, 0) = "壹": chap(11, 1) = 1 chap(12, 0) = "贰": chap(12, 1) = 2 chap(13, 0) = "叁": chap(13, 1) = 3 chap(14, 0) = "肆": chap(14, 1) = 4 chap(15, 0) = "伍": chap(15, 1) = 5 chap(16, 0) = "陆": chap(16, 1) = 6 chap(17, 0) = "柒": chap(17, 1) = 7 chap(18, 0) = "捌": chap(18, 1) = 8 chap(19, 0) = "玖": chap(19, 1) = 9 chap(20, 0) = "零": chap(20, 1) = 0 chap(21, 0) = "亿": chap(21, 1) = 100000000function subtochinese(price as integer)'转化千百十dim i as integerdim num(15) as integeri = 1 do until price = 0 num(i) = int(price / chap(i, 1)) if num(i) <> 0 then subtochinese = subtochinese & chap(num(i) + 10, 0) & chap(i, 0) price = price - num(i) * chap(i, 1) else if subtochinese <> "" and right(subtochinese, 1) <> "零" then subtochinese = subtochinese & "零" end if end if i = i + 1 loop if right(subtochinese, 1) = "元" then subtochinese = left(subtochinese, len(subtochinese) - 1) end ifend functionfunction pricetochinese(price as double) if price >= 100000000 then '大于1亿 pricetochinese = pricetochinese & pricetochinese(int(price / 100000000)) & "亿" price = price - int(price / 100000000) * 100000000 end if if price >= 10000 then pricetochinese = pricetochinese & subtochinese(int(price / 10000)) & "万" price = price - int(price / 10000) * 10000 end if if int(price) <> 0 then '如果万与千间无数,则应添零 if pricetochinese <> "" and int(price) < 1000 then pricetochinese = pricetochinese & "零" end if pricetochinese = pricetochinese & subtochinese(int(price)) price = price - int(price) end if if pricetochinese <> "" then pricetochinese = pricetochinese & "元" if price = 0 then '到元为止 pricetochinese = pricetochinese & "整" else price = int(price * 100) if int(price / 10) <> 0 then pricetochinese = pricetochinese & chap(int(price / 10) + 10, 0) & "角" price = price - int(price / 10) * 10 end if if price <> 0 then pricetochinese = pricetochinese & chap(int(price) + 10, 0) & "分" end if end ifend function调用时:pricetochinese(123432435.345) shell隐藏运行无效 vb picturebox背景透明 怎么把字符串里的数赋值给数组 VB如何得到as网页purl请求中的参数值,并且如何返回response? 网络音视频通信 Inet控件的扩展使用问题 操作符丢失?怎么办?很急,有答案马上结贴 关于ado的问题!请各位大侠帮助! 但是为什么我的记录写不到表中的问题一直没有解决!代码如下 有關ini文件取值不是數值的問題 怎样才能得到其他窗口的句柄?? 如何判断一个驱动器是 光盘 还是 硬 盘
初始化: chap(0, 0) = "万": chap(0, 1) = 10000
chap(1, 0) = "仟": chap(1, 1) = 1000
chap(2, 0) = "佰": chap(2, 1) = 100
chap(3, 0) = "拾": chap(3, 1) = 10
chap(4, 0) = "元": chap(4, 1) = 1
chap(5, 0) = "角": chap(5, 1) = 0.1
chap(6, 0) = "分": chap(6, 1) = 0.01
chap(11, 0) = "壹": chap(11, 1) = 1
chap(12, 0) = "贰": chap(12, 1) = 2
chap(13, 0) = "叁": chap(13, 1) = 3
chap(14, 0) = "肆": chap(14, 1) = 4
chap(15, 0) = "伍": chap(15, 1) = 5
chap(16, 0) = "陆": chap(16, 1) = 6
chap(17, 0) = "柒": chap(17, 1) = 7
chap(18, 0) = "捌": chap(18, 1) = 8
chap(19, 0) = "玖": chap(19, 1) = 9
chap(20, 0) = "零": chap(20, 1) = 0
chap(21, 0) = "亿": chap(21, 1) = 100000000function subtochinese(price as integer)
'转化千百十
dim i as integer
dim num(15) as integer
i = 1
do until price = 0
num(i) = int(price / chap(i, 1))
if num(i) <> 0 then
subtochinese = subtochinese & chap(num(i) + 10, 0) & chap(i, 0)
price = price - num(i) * chap(i, 1)
else
if subtochinese <> "" and right(subtochinese, 1) <> "零" then
subtochinese = subtochinese & "零"
end if
end if
i = i + 1
loop
if right(subtochinese, 1) = "元" then
subtochinese = left(subtochinese, len(subtochinese) - 1)
end if
end functionfunction pricetochinese(price as double)
if price >= 100000000 then '大于1亿
pricetochinese = pricetochinese & pricetochinese(int(price / 100000000)) & "亿"
price = price - int(price / 100000000) * 100000000
end if
if price >= 10000 then
pricetochinese = pricetochinese & subtochinese(int(price / 10000)) & "万"
price = price - int(price / 10000) * 10000
end if
if int(price) <> 0 then '如果万与千间无数,则应添零
if pricetochinese <> "" and int(price) < 1000 then
pricetochinese = pricetochinese & "零"
end if
pricetochinese = pricetochinese & subtochinese(int(price))
price = price - int(price)
end if
if pricetochinese <> "" then pricetochinese = pricetochinese & "元"
if price = 0 then '到元为止
pricetochinese = pricetochinese & "整"
else
price = int(price * 100)
if int(price / 10) <> 0 then
pricetochinese = pricetochinese & chap(int(price / 10) + 10, 0) & "角"
price = price - int(price / 10) * 10
end if
if price <> 0 then
pricetochinese = pricetochinese & chap(int(price) + 10, 0) & "分"
end if
end if
end function
调用时:pricetochinese(123432435.345)