⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 字符串的基本操作,搜索字符串中是否包含此字符,代码非常简短,很有实用价值.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   8535
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10260
   LinkTopic       =   "Form1"
   ScaleHeight     =   8535
   ScaleWidth      =   10260
   StartUpPosition =   3  'Windows Default
   Begin VB.TextBox Text1 
      Enabled         =   0   'False
      Height          =   5415
      Left            =   4575
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   5
      TabStop         =   0   'False
      Top             =   1080
      Width           =   5295
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   2295
      TabIndex        =   4
      Top             =   6840
      Width           =   1575
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   2295
      TabIndex        =   3
      Top             =   7560
      Width           =   1575
   End
   Begin VB.CommandButton Command1 
      Caption         =   "display"
      Height          =   375
      Left            =   4455
      TabIndex        =   2
      Top             =   6840
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "search"
      Height          =   375
      Left            =   4455
      TabIndex        =   1
      Top             =   7680
      Width           =   1215
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Exit"
      Height          =   495
      Left            =   8535
      TabIndex        =   0
      Top             =   7560
      Width           =   1095
   End
   Begin VB.Label Label6 
      Height          =   495
      Left            =   6240
      TabIndex        =   18
      Top             =   7440
      Width           =   2055
   End
   Begin VB.Label Label1 
      Caption         =   "UAR components names:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Index           =   0
      Left            =   480
      TabIndex        =   17
      Top             =   240
      Width           =   2295
   End
   Begin VB.Label Label1 
      Caption         =   "7.Relationship to Other Usability Aspects"
      Height          =   375
      Index           =   1
      Left            =   480
      TabIndex        =   16
      Top             =   5940
      Width           =   3375
   End
   Begin VB.Label Label1 
      Caption         =   "6.Possible Solutions and Potential Trade-offs"
      Height          =   375
      Index           =   2
      Left            =   480
      TabIndex        =   15
      Top             =   5115
      Width           =   3495
   End
   Begin VB.Label Label1 
      Caption         =   "5.Severity of the Problem or Benefit of the Good Feature"
      Height          =   375
      Index           =   3
      Left            =   480
      TabIndex        =   14
      Top             =   4290
      Width           =   4095
   End
   Begin VB.Label Label1 
      Caption         =   "4.Explanation of the Aspect"
      Height          =   375
      Index           =   4
      Left            =   480
      TabIndex        =   13
      Top             =   3465
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "3.Evidence for the Aspect"
      Height          =   375
      Index           =   5
      Left            =   480
      TabIndex        =   12
      Top             =   2640
      Width           =   2175
   End
   Begin VB.Label Label1 
      Caption         =   "2.Succinct Description of the Usability Aspect"
      Height          =   375
      Index           =   6
      Left            =   480
      TabIndex        =   11
      Top             =   1830
      Width           =   3375
   End
   Begin VB.Label Label1 
      Caption         =   "1.UAR identifier"
      Height          =   375
      Index           =   7
      Left            =   480
      TabIndex        =   10
      Top             =   1005
      Width           =   2175
   End
   Begin VB.Label Label2 
      Caption         =   "UAR component description:"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4695
      TabIndex        =   9
      Top             =   240
      Width           =   4815
   End
   Begin VB.Label Label3 
      Caption         =   "Enter a Number:"
      Height          =   495
      Left            =   495
      TabIndex        =   8
      Top             =   6840
      Width           =   1575
   End
   Begin VB.Label Label4 
      Caption         =   "Enter a search string"
      Height          =   495
      Left            =   495
      TabIndex        =   7
      Top             =   7560
      Width           =   1575
   End
   Begin VB.Label Label5 
      Caption         =   "found at:"
      Height          =   375
      Left            =   6255
      TabIndex        =   6
      Top             =   6840
      Width           =   1455
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()

Dim i As Integer
i = Val(Text2.Text)

If i = 1 Then
Text1.Text = "1.UAR identifier"
Text2.Text = ""
Text2.SetFocus
ElseIf i = 2 Then
Text1.Text = "2.Succinct Description of the Usability Aspect"
Text2.Text = ""
Text2.SetFocus
ElseIf i = 3 Then
Text1.Text = "3.Evidence for the Aspect"
Text2.Text = ""
Text2.SetFocus
ElseIf i = 4 Then
Text1.Text = "4.Explanation of the Aspect"
Text2.Text = ""
Text2.SetFocus

ElseIf i = 5 Then
Text1.Text = "5.Severity of the Problem or Benefit of the Good Feature"
Text2.Text = ""
Text2.SetFocus
ElseIf i = 6 Then
Text1.Text = "6.Possible Solutions and Potential Trade-offs"
Text2.Text = ""
Text2.SetFocus
ElseIf i = 7 Then
Text1.Text = "7.Relationship to Other Usability Aspects"
Text2.Text = ""
Text2.SetFocus
Else
MsgBox "您输入的数字无效,请输入1-7中的一个数字"
Text2.Text = ""
Text2.SetFocus


End If



End Sub

Private Sub Command2_Click()
Dim sa As String
sa = "shanghai,beijing,guangzhou"

Dim FindThisString As String
FindThisString = Text3.Text

Dim iPos As Integer
Dim iMatch As Integer

iPos = sa.IndexOf(FindThisString, iPos)
If iPos <> -1 Then
Label6.Caption = "currence 1:" + iPos


'If InStr(sa, FindThisString) <> 0 Then

Else
MsgBox "没有找到你要搜索的关键字"
End If


End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -