popbook.frm

来自「This a complete inventory management sys」· FRM 代码 · 共 182 行

FRM
182
字号
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form popBook 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "iManager - SELECT BOOK"
   ClientHeight    =   5460
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4830
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5460
   ScaleWidth      =   4830
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox txtSearch 
      Height          =   285
      Left            =   90
      TabIndex        =   4
      Top             =   450
      Width           =   4605
   End
   Begin VB.CommandButton cmdDone 
      Caption         =   "&Done"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   285
      Left            =   3870
      TabIndex        =   3
      Top             =   90
      Width           =   825
   End
   Begin VB.TextBox txtBookID 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1665
      TabIndex        =   1
      Top             =   90
      Width           =   1455
   End
   Begin MSFlexGridLib.MSFlexGrid MSGrid 
      Height          =   4560
      Left            =   90
      TabIndex        =   0
      Top             =   810
      Width           =   4650
      _ExtentX        =   8202
      _ExtentY        =   8043
      _Version        =   393216
      SelectionMode   =   1
   End
   Begin VB.TextBox txtValidate 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1800
      TabIndex        =   5
      Top             =   2520
      Visible         =   0   'False
      Width           =   1215
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Book ID"
      BeginProperty Font 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   195
      Left            =   180
      TabIndex        =   2
      Top             =   135
      Width           =   705
   End
End
Attribute VB_Name = "popBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdDone_Click()
Me.Hide
End Sub

Private Sub Form_Activate()
txtSearch.SetFocus
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 27
    txtBookID = ""
    Me.Hide
End Select
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
    Case 4
        cmdDone_Click
End Select
End Sub

Private Sub Form_Load()
FillGrid ("")
End Sub

Private Sub MSGrid_Click()
If MSGrid.Rows > 1 Then
txtBookID = Trim(MSGrid.TextMatrix(MSGrid.Row, 3))
End If
End Sub

Private Sub MSGrid_DblClick()
MSGrid_Click
cmdDone_Click
End Sub

Private Sub MSGrid_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
    Case 13
        MSGrid_Click
        cmdDone_Click
End Select
End Sub

Private Sub txtSearch_Change()
Call FillGrid(txtSearch)
End Sub

Private Function FillGrid(pStr As String)

Dim rstSearch As ADODB.Recordset
Dim gString, i
Set rstSearch = New ADODB.Recordset
If Trim(pStr) = "" Then
gString = "select * from aBookMaster order by b_Id"
Else
gString = "select * from aBookMaster where b_Id like '%" & fnEscapeQuote(Trim(pStr)) & "%' or b_Name like '%" & fnEscapeQuote(Trim(pStr)) & "%' or b_Desc like '%" & fnEscapeQuote(Trim(pStr)) & "%' order by b_Id"
End If
Set rstSearch = CNimanager.Execute(gString)
With MSGrid
        .Rows = 1
        .Clear
        .Cols = 4
        .ColAlignment(0) = flexAlignCenterCenter
        .ColWidth(0) = 500
        .ColWidth(1) = 1500
        .ColWidth(2) = 1500
        .ColWidth(3) = 1000
        .TextMatrix(0, 0) = "S No"
        .TextMatrix(0, 1) = "Book Name"
        .TextMatrix(0, 2) = "Book Description"
        .TextMatrix(0, 3) = "Book ID"
    If Not rstSearch.EOF Or Not rstSearch.BOF Then
        Do While Not rstSearch.EOF
            .Rows = .Rows + 1
            i = .Rows - 1
            .TextMatrix(i, 0) = i
            .TextMatrix(i, 1) = rstSearch("b_Name")
            .TextMatrix(i, 2) = rstSearch("b_Desc")
            .TextMatrix(i, 3) = rstSearch("b_Id")
            i = i + 1
        rstSearch.MoveNext
        Loop
    End If
End With
End Function

⌨️ 快捷键说明

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