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

📄 例12.frm

📁 在VB5环境下开发的VB程序集,窗体控件源代码.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frm8_7_7 
   Caption         =   "例12:利用顺序查找法找出数组中的某个数"
   ClientHeight    =   4425
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   5790
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   4425
   ScaleWidth      =   5790
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "开 始"
      Height          =   615
      Left            =   2160
      TabIndex        =   0
      Top             =   360
      Width           =   1335
   End
End
Attribute VB_Name = "frm8_7_7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a()
Private Sub Command1_Click()
   Dim myrecord As Integer
   myword = Val(InputBox("请输入要查找的关键字"))
   Call search(a, myword, myrecord)
   If myrecord = -1 Then
      MsgBox "没有您要查找的关键字", vbInformation + vbOKOnly, "查询结果"
   Else
      MsgBox "您要查找的关键字位置为" & myrecord, vbInformation + vbOKOnly, "查询结果"
   End If
End Sub
Public Sub search(p(), ByVal keyword, record As Integer)
   Dim x As Integer
   record = -1
   For x = LBound(p) To UBound(p)
   If p(x) = keyword Then
      record = x: Exit For
   End If
   Next
End Sub
Private Sub Form_Load()
frm8_7_7.Show
 ReDim a(1 To 50)
   For i = 1 To 50
     a(i) = Int(Rnd * 91 + 10)
     Print a(i)
   Next
End Sub

⌨️ 快捷键说明

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