Private Sub Command1_Click() Dim i As Integer Dim n As Integer Dim x As String Dim y As Integer, z i

2024-11-27 18:31:56
推荐回答(2个)
回答1:

修改后的代码
Private Sub Command1_Click()
Dim i As Integer
Dim n As Integer
Dim x As String
Dim y As Integer, z
i = Len(Text1.Text)
x = Text1.Text
Text1.Text = ""
For n = 1 To i
z = Mid(x, n, 1)
y = Asc(z)
If y > 96 And y < 123 Then
z = UCase(z)
ElseIf y > 64 And y < 91 Then
z = LCase(z)
Exit For
End If
Text1.Text = Text1.Text & z
Next
End Sub
Private Sub Command2_Click()
Dim i As Integer
Dim n As Integer
Dim x As String
Dim y As Integer, z
i = Len(Text1.Text)
x = Text1.Text
Text1.Text = ""
For n = 1 To i
z = Mid(x, n, 1)
y = Asc(z)
If y > 96 And y < 123 Then
z = z
ElseIf y > 64 And y < 96 Then
z = LCase(z)
Exit For
End If
Text1.Text = Text1.Text & z
Next n
End Sub
Private Sub Command3_Click()
Dim i As Integer
Dim n As Integer
Dim x As String
Dim y As Integer, z
i = Len(Text1.Text)
x = Text1.Text
Text1.Text = ""
For n = 1 To i
z = Mid(x, n, 1)
y = Asc(z)
If y > 96 And y < 123 Then
z = 2
ElseIf y > 64 And y < 91 Then
z = LCase(z)
Exit For
End If
Text1.Text = Text1.Text & z
Next n
End Sub
Private Sub Command4_Click()
Text1.Text = ""
End Sub

回答2:

把z=z上边的if 放到else后边 变成ifelse 就行了。