给你一个现成的,加两个控件,一个Label1,一个Text1:
Private Sub Form_Load()
'初始化设置
Text1.MaxLength = 16
Text1.Text = ""
Label1.Caption = ""
Label1.AutoSize = True
Label1.BorderStyle = 1
Label1.FontSize = 18
End Sub
Private Sub Text1_Change()
'调用转换子过程
Label1.Caption = CChinese(Text1.Text)
End Sub
Private Function CChinese(StrEng As String) As String
'验证数据
If Not IsNumeric(StrEng) Then
If Trim(StrEng) <> "" Then MsgBox "无效的数字"
CChinese = ""
Exit Function
End If
'定义变量
Dim intLen As Integer, intCounter As Integer
Dim strCh As String, strTempCh As String
Dim strSeqCh1 As String, strSeqCh2 As String
Dim strEng2Ch As String
strEng2Ch = "零壹贰叁肆伍陆柒捌玖"
strSeqCh1 = " 拾佰仟 拾佰仟 拾佰仟 拾佰仟"
strSeqCh2 = " 万亿兆"
'转换为表示数值的字符串
StrEng = CStr(CDec(StrEng))
'记录数字的长度
intLen = Len(StrEng)
'转换为汉字
For intCounter = 1 To intLen
'返回数字对应的汉字
strTempCh = Mid(strEng2Ch, Mid(StrEng, intCounter, 1) + 1, 1)
'若某位是零
If strTempCh = "零" And intLen <> 1 Then
'若后一个也是零,或零出现在倒数第1、5、9、13等位,则不显示汉字“零”
If Mid(StrEng, intCounter + 1, 1) = "0" Or (intLen - intCounter + 1) Mod 4 = 1 Then strTempCh = ""
Else
strTempCh = strTempCh & Trim(Mid(strSeqCh1, intLen - intCounter + 1, 1))
End If
'对于出现在倒数第1、5、9、13等位的数字
If (intLen - intCounter + 1) Mod 4 = 1 Then
'添加位" 万亿兆"
strTempCh = strTempCh & Trim(Mid(strSeqCh2, (intLen - intCounter) \ 4 + 1, 1))
End If
'组成汉字表达式
strCh = strCh & Trim(strTempCh)
Next
CChinese = strCh
End Function