第3个回答 推荐于2018-02-28
转换小写为大写:LCase函数,例如XX = LCase("abcd"),返回值:XX = "ABCD"
转换大写为小写:UCase函数,例如XX = UCase("ABCD"),返回值:XX = "abcd"
可以:XX = LCase(Text1.Text) 或 XX = UCase(Text1.Text),全部转换为大写或小写;如果 Text1.Text 中的大写转换为小写,小写转换为大写,需要逐字符检测并转换。
代码如下:
Private Sub Command1_Click()
Dim XX As String, YY As String, ZZ As String, AA As Integer, I As Integer
XX = Text1.Text
AA = Len(XX)
For I = 1 To AA
ZZ = Mid(XX, I, 1)
If Asc(ZZ) >= 65 And Asc(ZZ) <= 90 Then
ZZ = LCase(ZZ)
ElseIf Asc(ZZ) >= 97 And Asc(ZZ) <= 122 Then
ZZ = UCase(ZZ)
End If
YY = YY & ZZ
Next I
Text1.Text = YY
End Sub本回答被网友采纳