''功能:把数字总金额转换为大写金额
'Private Function AccountChang(ByRef strWan As String, ByRef strQian As String, ByRef strBai As String, ByRef strShi As String, _
' ByRef strKuai As String, ByRef strJiao As String, ByRef strFen As String, ByVal strAccount As String)
' Dim StrFPSum As String
' Dim intTemp(10)
' Dim strLeft As String
' Dim strRight As String
' Dim strBLeft As String
' Dim strBRight As String
'
' '初始化
' StrFPSum = ""
' strAccount = Format(strAccount, "#########0.00")
' intTemp(0) = "零": intTemp(1) = "壹": intTemp(2) = "贰": intTemp(3) = "叁": intTemp(4) = "肆"
' intTemp(5) = "伍": intTemp(6) = "陆": intTemp(7) = "柒": intTemp(8) = "捌": intTemp(9) = "疚"
'
' '取得小数点前后的字符串形式的数字
' strLeft = Left(strAccount, InStr(strAccount, ".") - 1)
' strRight = Mid(strAccount, Len(strAccount) - 1)
'
' For i = 0 To Len(strRight) - 1
' StrFPSum = intTemp(CInt(Mid(strRight, Len(strRight) - i, 1))) & StrFPSum
' Next
' StrFPSum = "." & StrFPSum
' For i = 0 To Len(strLeft) - 1
' StrFPSum = intTemp(CInt(Mid(strLeft, Len(strLeft) - i, 1))) & StrFPSum
' Next
'
' strBLeft = Left(StrFPSum, InStr(StrFPSum, ".") - 1)
' strBRight = Mid(StrFPSum, Len(StrFPSum) - 1)
'
'On Error Resume Next
' strFen = Mid(strBRight, 2, 1)
' strJiao = Mid(strBRight, 1, 1)
' strKuai = Mid(strBLeft, Len(strBLeft), 1)
' strShi = Mid(strBLeft, Len(strBLeft) - 1, 1)
' strBai = Mid(strBLeft, Len(strBLeft) - 2, 1)
' strQian = Mid(strBLeft, Len(strBLeft) - 3, 1)
' strWan = Mid(strBLeft, Len(strBLeft) - 4, 1)
'End Function我在外部调用这个函数
AccountChang Text1.Text, Text2.Text, Text3.Text, Text4.Text, Text5.Text, Text6.Text,Text7, Text8.Text
但是并没有在text1,text2...等中返回该返回的大写数字(text8.text为"13.23")
大家帮我调试一下看怎么解决这个问题我调试过,整个函数是没有错误的,就是在接口这个地方可能出现了问题。
'Private Function AccountChang(ByRef strWan As String, ByRef strQian As String, ByRef strBai As String, ByRef strShi As String, _
' ByRef strKuai As String, ByRef strJiao As String, ByRef strFen As String, ByVal strAccount As String)
' Dim StrFPSum As String
' Dim intTemp(10)
' Dim strLeft As String
' Dim strRight As String
' Dim strBLeft As String
' Dim strBRight As String
'
' '初始化
' StrFPSum = ""
' strAccount = Format(strAccount, "#########0.00")
' intTemp(0) = "零": intTemp(1) = "壹": intTemp(2) = "贰": intTemp(3) = "叁": intTemp(4) = "肆"
' intTemp(5) = "伍": intTemp(6) = "陆": intTemp(7) = "柒": intTemp(8) = "捌": intTemp(9) = "疚"
'
' '取得小数点前后的字符串形式的数字
' strLeft = Left(strAccount, InStr(strAccount, ".") - 1)
' strRight = Mid(strAccount, Len(strAccount) - 1)
'
' For i = 0 To Len(strRight) - 1
' StrFPSum = intTemp(CInt(Mid(strRight, Len(strRight) - i, 1))) & StrFPSum
' Next
' StrFPSum = "." & StrFPSum
' For i = 0 To Len(strLeft) - 1
' StrFPSum = intTemp(CInt(Mid(strLeft, Len(strLeft) - i, 1))) & StrFPSum
' Next
'
' strBLeft = Left(StrFPSum, InStr(StrFPSum, ".") - 1)
' strBRight = Mid(StrFPSum, Len(StrFPSum) - 1)
'
'On Error Resume Next
' strFen = Mid(strBRight, 2, 1)
' strJiao = Mid(strBRight, 1, 1)
' strKuai = Mid(strBLeft, Len(strBLeft), 1)
' strShi = Mid(strBLeft, Len(strBLeft) - 1, 1)
' strBai = Mid(strBLeft, Len(strBLeft) - 2, 1)
' strQian = Mid(strBLeft, Len(strBLeft) - 3, 1)
' strWan = Mid(strBLeft, Len(strBLeft) - 4, 1)
'End Function我在外部调用这个函数
AccountChang Text1.Text, Text2.Text, Text3.Text, Text4.Text, Text5.Text, Text6.Text,Text7, Text8.Text
但是并没有在text1,text2...等中返回该返回的大写数字(text8.text为"13.23")
大家帮我调试一下看怎么解决这个问题我调试过,整个函数是没有错误的,就是在接口这个地方可能出现了问题。
解决方案 »
- 在线等,非常急
- VB能处理来电弹屏的工作吗!
- 如何获取软件的安装日期且保存安装日期?
- UTF-8如何转换成GB2312并显示?急....在线等
- 请问为什么我的数据(数字,双精度.例如2383.33)读进vsflexgrid/datagrid的时候只显示2383的呢?请指教,谢谢!(数据库是用access)
- 已知应用程序窗口的hWnd,如何disable word窗口的“最大化”、“最小化”和“关闭”按钮?
- 高分求解:如何调试VB编写的ActiveX DLL程序,谢谢!
- 关于DataReport的高分题!如何不用数据环境而只用ADODB.Recordset而做出Group效果?
- 数组的下标如何用变量表示?
- 各位帮我看看这个程序有什么错误!!
- 关于data report 问题。
- 简单问题,请教!
AccountChang str1, str2, str2 ...
Text1.Text = str1
Text2.Text = str2
...
AccountChang strWans, strQians, strBais, strShis, strKuais, strJiaos, strFens, Text8.Text
Private Function AccountChang(ByVal strWan As String, ByVal strQian As String, ByVal strBai As String, _
ByVal strShi As String, _
ByVal strKuai As String, ByVal strJiao As String, ByVal strFen As String, ByVal strAccount As String)
Dim StrFPSum As String
Dim intTemp(10)
Dim strLeft As String
Dim strRight As String
Dim strBLeft As String
Dim strBRight As String '初始化
StrFPSum = ""
strAccount = Format(strAccount, "#########0.00")
intTemp(0) = "零": intTemp(1) = "壹": intTemp(2) = "贰": intTemp(3) = "叁": intTemp(4) = "肆"
intTemp(5) = "伍": intTemp(6) = "陆": intTemp(7) = "柒": intTemp(8) = "捌": intTemp(9) = "疚" '取得小数点前后的字符串形式的数字
strLeft = Left(strAccount, InStr(strAccount, ".") - 1)
strRight = Mid(strAccount, Len(strAccount) - 1) For i = 0 To Len(strRight) - 1
StrFPSum = intTemp(CInt(Mid(strRight, Len(strRight) - i, 1))) & StrFPSum
Next
StrFPSum = "." & StrFPSum
For i = 0 To Len(strLeft) - 1
StrFPSum = intTemp(CInt(Mid(strLeft, Len(strLeft) - i, 1))) & StrFPSum
Next strBLeft = Left(StrFPSum, InStr(StrFPSum, ".") - 1)
strBRight = Mid(StrFPSum, Len(StrFPSum) - 1)On Error Resume Next
strFen = Mid(strBRight, 2, 1)
strJiao = Mid(strBRight, 1, 1)
strKuai = Mid(strBLeft, Len(strBLeft), 1)
strShi = Mid(strBLeft, Len(strBLeft) - 1, 1)
If Len(strBLeft) - 2 = 0 Then
strBai = "零"
Else
strBai = Mid(strBLeft, Len(strBLeft) - 2, 1)
End If
If Len(strBLeft) - 2 = 0 Or Len(strBLeft) - 3 = 0 Then
strQian = "零"
Else
strQian = Mid(strBLeft, Len(strBLeft) - 3, 1)
End If
If Len(strBLeft) - 2 = 0 Or Len(strBLeft) - 3 = 0 Or Len(strBLeft) - 4 = 0 Then
strWan = "零"
Else
strWan = Mid(strBLeft, Len(strBLeft) - 4, 1)
End If
Text1.Text = strWan
Text2.Text = strQian
Text3.Text = strBai
Text4.Text = strShi
Text5.Text = strKuai
Text6.Text = strJiao
Text7.Text = strFen
End Function