VB:在文本框中输入英文字符,单击按钮会将文本框中的所有大写字符转换为小写,所有小写字符转换为大写
在窗体上放置1个文本框和1个按钮,在文本框中输入英文字符,单击按钮会将文本框中的所有大写字符转换为小写,所有小写字符转换为大写...
在窗体上放置1个文本框和1个按钮,在文本框中输入英文字符,单击按钮会将文本框中的所有大写字符转换为小写,所有小写字符转换为大写
展开
2个回答
展开全部
Private Sub Command1_Click()
Dim s As String, t As String, p As String
s = Text1.Text
t = ""
For i = 1 To Len(s)
p = Mid(s, i, 1)
If Asc(p) > 96 And Asc(p) < 123 Then
t = t & Chr(Asc(p) - 32)
End If
If Asc(p) > 64 And Asc(p) < 91 Then
t = t & Chr(Asc(p) + 32)
End If
Next i
Text1.Text = t
End Sub
Private Sub Form_Load()
Text1.Text = "AaBbCcDdEeFfGgHhIiJjKk"
End Sub
展开全部
Private Sub Command1_Click()
dim s as string,s1 as string
s = text1
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "a" And ch <= "z" Then
s1 = s1 + UCase(ch)
ElseIf ch >= "A" And ch <= "Z" Then
s1 = s1 + LCase(ch)
End If
Next i
text1=s1
End Sub
dim s as string,s1 as string
s = text1
For i = 1 To Len(s)
ch = Mid(s, i, 1)
If ch >= "a" And ch <= "z" Then
s1 = s1 + UCase(ch)
ElseIf ch >= "A" And ch <= "Z" Then
s1 = s1 + LCase(ch)
End If
Next i
text1=s1
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询