vb·vb 判断两个字符串是否有重复
a=2,将来可变b=12349c=0567如果a和b有重复的则msgbox弹出"和b有重复的”如果a和b有重复的则msgbox弹出"和c有重复的”该如何写...
a=2,将来可变
b=12349
c=0567
如果a和b有重复的则msgbox弹出"和b有重复的”
如果a和b有重复的则msgbox弹出"和c有重复的”
该如何写 展开
b=12349
c=0567
如果a和b有重复的则msgbox弹出"和b有重复的”
如果a和b有重复的则msgbox弹出"和c有重复的”
该如何写 展开
3个回答
展开全部
添加一个COMMAND。在COMMAND中写入下代码,若a可变,可以添加一个TEXT控件,通过a=text1.text获得a的值。
Dim a As String
Dim b As String
Dim c As String
Private Sub Command1_Click()
a = "2"
b = "12349 "
c = "0567"
For i = 1 To Len(b)
If Mid(b, i, 1) = a Then
Msg = "和b有重复的" ' 定义信息。
Response = MsgBox(Msg)
End If
Next i
For i = 1 To Len(c)
If Mid(c, i, 1) = a Then
Msg = "和c有重复的" ' 定义信息。
Response = MsgBox(Msg)
End If
Next i
End Sub
Dim a As String
Dim b As String
Dim c As String
Private Sub Command1_Click()
a = "2"
b = "12349 "
c = "0567"
For i = 1 To Len(b)
If Mid(b, i, 1) = a Then
Msg = "和b有重复的" ' 定义信息。
Response = MsgBox(Msg)
End If
Next i
For i = 1 To Len(c)
If Mid(c, i, 1) = a Then
Msg = "和c有重复的" ' 定义信息。
Response = MsgBox(Msg)
End If
Next i
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
如果你的题意思这样的话,给你一个代码,在窗体上放一个命令按纽,代码如下
Private Sub Command1_Click()
Dim a As String, b As String, c As String
a = 2
b = 12349
c = 567
a = InputBox("想给a赋值为:")
Print "a=" & a
If a = b Then MsgBox "和b有重复的"
If a = c Then MsgBox "和c有重复的"
End Sub
Private Sub Command1_Click()
Dim a As String, b As String, c As String
a = 2
b = 12349
c = 567
a = InputBox("想给a赋值为:")
Print "a=" & a
If a = b Then MsgBox "和b有重复的"
If a = c Then MsgBox "和c有重复的"
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
用两个循环
b和c的值是固定的吗?~
b和c的值是固定的吗?~
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询