。如何编程:输入一个字符,如果他是大写英文字母,则将其转换为小写英文字母;如果他是小写英文字母,则将其转
2个回答
展开全部
控件Text1是输入字符
Text2是输出结果
Private Sub Text1_Change()
'变量声明时注意定义变量类型
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 + UCase(CH)
ElseIf CH >= "A" And CH <= "Z" Then
S = S + LCase(CH)
End If
Next I
Text2.Text = S
End Sub
Text2是输出结果
Private Sub Text1_Change()
'变量声明时注意定义变量类型
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 + UCase(CH)
ElseIf CH >= "A" And CH <= "Z" Then
S = S + LCase(CH)
End If
Next I
Text2.Text = S
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询