VB编程 编写一个转换大小写的程序

编写一个对输入的字符进行大小写转换的程序。规则为:将大写字母转换为小写,小写转换为大写,空格不转换,其余都转换成“*”。要求每输入一个字符后就立马进行判断和转换。

第1个回答  推荐于2016-08-19
'文字控件Text1
Dim a As String

Private Sub Text1_Change()
If Text1.Text = a$ Then Exit Sub
a = Text1.Text
If a$ <> "" Then
For i = 1 To Len(a)
t$ = Mid$(a, i, 1)
If t$ <= "Z" And t$ >= "A" Then
t$ = LCase$(t$)
ElseIf t$ <= "z" And t$ >= "a" Then
t$ = UCase$(t$)
Else
If t$ <> " " Then t$ = "*"
End If
Mid$(a, i, 1) = t$
Next i
Text1.Text = a
End If
End Sub本回答被提问者采纳

请问用VB怎样实现将一串英文字母进行大小写转换啊?跪求程序代码
想要转换为大写:变量=UCase(字符串)比如:Dim AAA As String AAA=Inputbox("请输入一串英文字符")me.caption=LCase(AAA)这样就能在窗体的标题上显示刚才输入的小写字符了

vb编写程序对输入字符串进行大小写转换。
Private Sub Command1_Click()Cls x = InputBox("")Picture1.Print UCase(x) '大写 Picture1.Print LCase(x) '小写 End Sub

用VB脚本编写一个大小写转换的工具
End Sub 如要EXE找我吧。嘿...

vb编程:实现钱的大小写转换(整数)
Private Sub Command1_Click()Text2.Text = Num2Chi(Val(Text1.Text))End Sub Private Function Num2Chi(txtJE As Double) As String Dim i, K As Integer Dim NC, nd, ka, chrNum, strZheng As String Dim c1, c2, c3 As String Dim K1 As Integer Dim Zheng As St...

VB编程基础问题(英文大小写转换)
'若是有3个文本框,一个“运行”按钮 '一个文本框输入,一个输出转换成大写的结果,一个输出字母个数 Private Sub Command1_Click()Text2.Text = UCase(Text1.Text) '用UCase将所有字母转为大写,在text2中输出 text3.text=len(Text1.Text) 'len()统计字符串长度,在text3中输出 End...

Vb编写一个可以自动马上转化大小写字母空格不转换其他的转化成*
'给你写了一个自定义函数把大小写字母空格不转换其他的转化成 Function zh(a As String) As String For i = 1 To Len(a)If Mid(a, i, 1) Like "[A-Za-z]" Or Mid(a, i, 1) = " " Then zh = zh & Mid(a, i, 1)Else zh = zh & "*"End If Next End Function Privat...

vb程序 大写字母转小写,小写转大写
Print UCase(a)Case Asc("A") To Asc("Z")Print LCase(a)End Select End Sub '第二题 Private Sub Command1_Click()a = Val(InputBox(""))If (a Mod 4 = 0 And a Mod 100 <> 0) Or a Mod 400 = 0 Then Print a & "是闰年"Else Print a & "不是闰年"End If End Sub...

VB中,用If语句编写大小写字母转换程序,急用
是只输入一个字母吗?(如果是,代码如下)如果是要输入字符串,可追问 Private Sub Command1_Click()n = Asc(Text1.Text)If n >= 65 And n <= 90 Then n = n + 32 Text1.Text = Chr(n)ElseIf n >= 97 And n <= 122 Then n = n - 32 Text1.Text = Chr(n)End If End ...

vb大小写转换
下面是应用Lcase函数 进行大小写转换:Private Sub Command1_Click()Dim X As String Dim I As Long Dim S As String Dim CH As String \/\/定义输入输出量X = Text1.Text For I = 1 To Len(X) CH = Mid(X, I, 1)If CH >= "a " And CH <= "z" Then S = S + ...

VB 大小写转换。???
用两个函数,转小写lcase,转大写ucase Public a As String Private Sub Command1_Click()a = LCase(a)Text1.Text = a End Sub Private Sub Command2_Click()a = UCase(a)Text1.Text = a End Sub Private Sub Form_Load()a = "C4CA4238A0B923820DCC509A6F75849B"End Sub ...

相似回答