建立 文本框text1 ,text2 按钮 command1 复制以下代码
Dim a(10) As Integer, b(10) As String
Private Sub Command1_Click()
Dim x, y As Integer
If Len(Text1.Text) > 0 Then '当文本框中有数字时
If Len(Text1.Text) = 1 Then '当文本框1中只有1位数字时
x = Val(Text1.Text) 'x等于文本框中的数字
Text2.Text = b(x) '文本框2显示该数字的大写汉字
ElseIf Len(Text1.Text) = 2 Then '当文本框1中有2位数字时
x = Left(Text1.Text, 1) 'x等于第一位
y = Right(Text1.Text, 1) 'y等于第二位
If x = 1 And y > 0 Then '判断,当文本框中的数字在11到19之间时
Text2.Text = b(10) & b(y)
ElseIf x > 1 And y > 0 Then '判断,当文本框中的数字在21到99之间时
Text2.Text = b(x) & b(10) & b(y)
ElseIf x > 0 And y = 0 Then '判断,当文本框中的数字为10的倍数时
Text2.Text = b(x) & b(10)
End If
End If
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
For i = 0 To 10
a(i) = i
Next i
b(0) = "零"
b(1) = "壹"
b(2) = "贰"
b(3) = "叁"
b(4) = "肆"
b(5) = "伍"
b(6) = "陆"
b(7) = "柒"
b(8) = "捌"
b(9) = "玖"
b(10) = "拾"
Text1.FontSize = 40
Text2.FontSize = 40
Text1.MaxLength = 2
Text2.Locked = True
End Sub
用VB,通过一个命令按钮,将阿拉伯数字金额转化成汉字大写金额~~求大神...
Private Sub Command3_Click()Dim i As Integer, k As Integer, l As Integer, m As Integer, tmp As String, s1 As String, s2 As String, s3 As String, s4 As String tmp = Format(Trim(Text1.Text), "0.00")l = InStr(1, tmp, ".")k = Len(tmp)For i = 1 To k ' ...
VB语言中如何将阿拉伯数字转换成大写人民币金额
Private Sub Text2_Change() '小写转大写 Dim i As Integer Dim j As Integer Dim myint As Integer Dim myint1 As Integer Dim mydoub As Double Dim mystr As String Dim mystr1 As String Dim mystr2 As String Dim mystr3 As String Dim mystr4 As String Dim money As Long Dim...
将阿拉伯数字0、1、2、……、8、9转换为汉语大写数字零、壹、贰...
include <iostream> include <string> using namespace std;bool IsNumber(char c);int HowMuch(char c);int main(){ char str[11][3]={"零","壹","贰","叁","肆","伍","陆","柒","捌","玖"};string s,newStr;cout<<"输入一些数字:"<<endl;cin>>s;for(int i=0; i<s....
求vb金额小写转为大写的代码,带详细注释的!!!
Dim strNum(10) As String '大写数字 Dim strUnit(16) As String '单位,比如 十,拾,万等 Dim strUnitB(2) As String '小数后的单位 '初始化 Select Case Typ Case 0 strNum(0) = "零": strNum(1) = "壹": strNum(2) = "贰": strNum(3) = "叁"strNum(4) = "肆": st...
英文版Excel中如何把数字转换成中文大写金额?
Function CChinese(StrEng As String) As String '将阿拉伯数字转成中文字的程式例如:1560890 转成 "壹佰伍拾陆万零捌佰玖拾"。'程式限制为不可输入超过16个数字 If Not IsNumeric(StrEng) Or StrEng Like "*.*" Or StrEng Like "*-*" Then If Trim(StrEng) <> "" Then MsgBox "无效的...
数字转中文的完整代码
result+=b[i]; } \/\/数字--单数转换 \/\/这里有个问题.就比如 18 转换后成了一八 而不是十八 \/\/如果这里还需要转换的话. 那还需要重新定义个函数. alert(result); } function gochange(s){ \/\/ } function getchinese(p){ var input=p; if(input=="0") return...
编一程序,将阿拉伯数字0、1、2、……、8、9转换为汉语大写数字零、壹...
i:integer;begin for i:=0 to 9 do read(a[i]);for i:=0 to 9 do a[i]:=a[i];begin case a[i] of 0:write('零');1:write('壹');2:write('贰');3:write('叁');4:wirte('肆');5:write('伍');6:write('陆');7:write('柒');8:write('捌');9:write('玖')...
关于阿拉伯数字转换成中文大写的js代码
人民币写法小写转大写,数字转成汉字书写。< function Money(thenumber)dim Money,i,String1,String2,length,checkp'定义变量 dim one(),onestr()'定义数组 String1 = "零壹贰叁肆伍陆柒捌玖"String2 = "万仟佰拾亿仟佰拾万仟佰拾元角分厘毫"checkp=instr(thenumber,".")'判断是否含有小数...
如何在excel中设置公式将数字转换为英文大写金额
一、首先打开Excel表格文件,按Alt+F11打开VBA窗口,插入一个“模块”。二、右键模块1,菜单内点击“导入文件”。三、找到数字转大写英文货币的BAS格式文件,点击“打开”。四、这时就可以把该函数导入VBA模块,另外如果是通过网格上粘贴的数字转英文大写金额函数,则真可以在下图白色区域内Ctrl+V粘贴进来...
vb编写程序对输入字符串进行大小写转换。
可以参考下面的代码:Private Sub Command1_Click()Cls x = InputBox("")Picture1.Print UCase(x) '大写 Picture1.Print LCase(x) '小写 End Sub