没有什么其他要求呵呵,送分啦
解决方案 »
- 关于MSCOMM控件,如何将一串16进制的还原成10进制?高手请请进,急急急!!!
- 关于vb中数据库的问题(登陆界面中用户名和密码注册,验证问题!)
- [高分]如何用代码修改 RTF格式 的文件?
- 为什么汉字不能添加到数据库中啊?
- form and form_keydown?
- VB操作数据库的问题
- VB连接远程SQL SERVER数据库的问题(在线急等)
- 超强VB界面控件ThemeControl,与大家一起分享。
- 控件更新数据的速度能否提高??急!
- 我在ADODC控件的“属性”中,生成了connectionString,连接SQL2k没问题,但是换在Form_Load输入就提示:[ODBC驱动程序管理器]未发现数据源
- 关于FindWindowEx的一个疑惑,请热心朋友解答
- 狗年大吉 第一份私活
将阿拉伯数字转成中文字的程式教程 一个Form 一个TextBox 一个Label 这个修订後的程式是当使用者在TextBox中输入只包含 0~9 的数值後,在Label中就可 看见被转换後的中文字,例如:1560890 转成 "壹佰伍拾陆万零捌佰玖拾"。程式限制 为不可输入超过16个数字。 请建立一个新专案,并在表单中放入上述物件,再把以下程式码复制到表单的程式 码视窗,最後按下F5来执行。 Private Sub Form_Load() Text1.MaxLength = 16 Text1.Text = "" Label1.Caption = "" Label1.AutoSize = True Label1.BorderStyle = 1 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) Or StrEng Like "*.*" Or StrEng Like "*-*" 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, Val(Mid(StrEng, intCounter, 1)) + 1, 1) If strTempCh = "零" And intLen <> 1 Then If Mid(StrEng, intCounter + 1, 1) = "0" Or (intLen - intCounter + 1) Mod 4 = 1 Then strTempCh = "" End If Else strTempCh = strTempCh & Trim(Mid(strSeqCh1, intLen - intCounter + 1, 1)) End If If (intLen - intCounter + 1) Mod 4 = 1 Then strTempCh = strTempCh & Mid(strSeqCh2, (intLen - intCounter + 1) \ 4 + 1, 1) If intCounter > 3 Then If Mid(StrEng, intCounter - 3, 4) = "0000" Then strTempCh = Left(strTempCh, Len(strTempCh) - 1) End If End If strCh = strCh & Trim(strTempCh) Next CChinese = strCh End Function