Private Sub Text2_Change() '大寫金額轉(zhuǎn)換成阿拉伯數(shù)字金額
成都創(chuàng)新互聯(lián)公司是專業(yè)的甘肅網(wǎng)站建設(shè)公司,甘肅接單;提供成都網(wǎng)站設(shè)計、成都網(wǎng)站制作,網(wǎng)頁設(shè)計,網(wǎng)站設(shè)計,建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進行甘肅網(wǎng)站開發(fā)網(wǎng)頁制作和功能擴展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團隊,希望更多企業(yè)前來合作!
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 money1 As Integer
Dim money2 As Long
mystr = Text2.Text
myint = InStr(mystr, ".")
If myint = 0 Then
mystr = Text2.Text
Else
mystr3 = Right(Text2.Text, Len(Text2.Text) - myint)
If mystr3 "" Then '轉(zhuǎn)換小數(shù)位
mystr4 = Left(mystr3, 1)
mystr3 = Right(mystr3, Len(mystr3) - 1)
If mystr4 "0" Then
mystr2 = mystr2 + setdata(Val(mystr4)) + "角"
End If
If mystr3 "" Then
mystr4 = Left(mystr3, 1)
mystr2 = mystr2 + setdata(Val(mystr4)) + "分"
End If
End If
mystr = Left(Text2.Text, myint - 1)
End If
j = Len(mystr)
For i = 1 To Len(mystr) '轉(zhuǎn)換整數(shù)位
money2 = Left(mystr, i)
money1 = Right(money2, 1)
If money1 = 0 Then
If j = 5 Then
If Right(mystr1, 1) "萬" Then mystr1 = mystr1 "萬"
Else
If Right(mystr1, 1) "零" And Right(money, j) 0 Then mystr1 = mystr1 "零"
End If
Else
mystr1 = mystr1 setdata(money1) + chang(j)
End If
j = j - 1
Next i
Text1.Text = mystr1 "元" mystr2 '顯示大寫
End Sub
String的成員函數(shù)中就有 ToUpper() 和 ToLower()啊
Dim a As String = "abcEd"
Dim b As String = a.ToUpper() //大寫
Dim c As String = a.ToLower() //小寫
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress e.KeyChar 使用參數(shù)e來控制輸入字符 End Sub 追問: 能給出大小寫切換程序的整段 源代碼 嗎 回答: 我不明白你的大小寫切換程序是要實現(xiàn)什么功能 是輸入 大寫 變小寫嗎? 追問: 是的 回答: If e.KeyChar.IsLower(e.KeyChar) = True Then e.KeyChar.ToUpper(e.KeyChar) 或 If e.KeyChar.IsUpper(e.KeyChar) = True Then e.KeyChar.ToLower(e.KeyChar)
Public Function je(ByVal szje As Double) As String
Dim s As String = ""
Dim sz() As String = {"零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖"}
Dim dw() As String = {"圓", "拾", "佰", "千", "萬", "拾", "佰", "仟", "拾", "佰", "仟"}
If szje 0 Then
s = "負"
szje = Math.Abs(szje)
End If
Dim zh() As String = Split(Str(szje), ".")
If zh.Length 2 Then
Return "ERROR:格式錯"
Exit Function
End If
zh(0) = Trim(zh(0))
zh(1) = Trim(zh(1))
Dim i As Integer
For i = 1 To Len(zh(0))
s = s sz(Val(Mid(zh(0), i, 1))) dw(Len(zh(0)) - i)
Next
For i = 1 To Len(zh(1))
s = s sz(Val(Mid(zh(1), i, 1))) Choose(i, "角", "分", "厘", "毫")
Next
s = s "整"
Return s
End Function
可以試著用典型的VB字符串函數(shù)UCase解決。
比如先把輸入的內(nèi)容放到字符串A$中,若A$="a",則經(jīng)
A$=UCase(A$)轉(zhuǎn)換后,結(jié)果即是A$="A"。
我在程序中是這麼處理的。行不行,試試就知道了。
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Dim s As String = "0Ff0ajkh04624F"
Dim i As Integer = 0
Dim sTemp As String = ""
Dim ss As String = ""
For i = 1 To Strings.Len(s)
sTemp = Mid(s, i, 1)
If Asc(sTemp) = 65 And Asc(sTemp) = 90 Then
sTemp = LCase(sTemp)
ElseIf Asc(sTemp) = 95 And Asc(sTemp) = 122 Then
sTemp = UCase(sTemp)
Else
sTemp = sTemp
End If
ss = ss sTemp
Next
MsgBox(ss)
End Sub