一道VB题目,求解答
在名称为form1的窗体上画一个名称为Text1的文本框和一个名称为C1的命令按钮,要求可以把text1中的大写字母转化为小写,把小写字母转化为大写求编程过程谢谢...
在名称为form1的窗体上画一个名称为Text1的文本框和一个名称为C1的命令按钮,要求可以把text1中的大写字母转化为小写,把小写字母转化为大写
求编程过程 谢谢 展开
求编程过程 谢谢 展开
展开全部
Private Sub C1_Click()
Dim a As String, b As String, c As String, i As Integer
a = StrConv(Text1.Text, vbUpperCase)
b = StrConv(Text1.Text, vbLowerCase)
For i = 1 To Len(Text1.Text)
If Mid(Text1.Text, i, 1) = Mid(a, i, 1) Then
c = c & Mid(b, i, 1)
ElseIf Mid(Text1.Text, i, 1) = Mid(b, i, 1) Then
c = c & Mid(a, i, 1)
Else
c = c & Mid(Text1.Text, i, 1)
End If
Next i
Text1.Text = c
End Sub
Dim a As String, b As String, c As String, i As Integer
a = StrConv(Text1.Text, vbUpperCase)
b = StrConv(Text1.Text, vbLowerCase)
For i = 1 To Len(Text1.Text)
If Mid(Text1.Text, i, 1) = Mid(a, i, 1) Then
c = c & Mid(b, i, 1)
ElseIf Mid(Text1.Text, i, 1) = Mid(b, i, 1) Then
c = c & Mid(a, i, 1)
Else
c = c & Mid(Text1.Text, i, 1)
End If
Next i
Text1.Text = c
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询