求几个现成的VB代码

来源:百度知道 编辑:UC知道 时间:2024/06/09 20:59:46
现成的弄几个VB代码

'你填写的必须为5位到6位数字,呵呵,超短的代码
Private Sub Command1_Click()
Dim testStr As String
Dim objRegExp As RegExp '创建一个正则表达式对象
Dim objMatch As Match
Dim colMatches As MatchCollection
Set objRegExp = New RegExp
testStr = Text1.Text
objRegExp.Pattern = "^\d{5,6}$" '正则表达式 (必须为5位到6位数字)
objRegExp.IgnoreCase = True '匹配是否区分大小写
objRegExp.Global = True
If (objRegExp.Test(testStr) = True) Then '开始匹配
MsgBox "success"
Else
MsgBox "fail"
End If
End Sub
说明:1.需要在引用 Microsoft VBScript Regular Expressions 5.5

Dim x As Integer
Private Sub Command1_Click()
Const 谜底1 As String = "筷子"
Const 谜底2 As String = "铅笔"
Const 谜底3 As String = "圆规"
n = InputBox("")
Select Case x
Case 1
If n = 谜底1 Then
MsgBo