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

📄 finddlg.frm

📁 汽车维修管理软件。其中包含三个编辑控件。
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FindDlg 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "查找"
   ClientHeight    =   4095
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6540
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4095
   ScaleWidth      =   6540
   ShowInTaskbar   =   0   'False
   Begin MSFlexGridLib.MSFlexGrid m_Grid 
      Height          =   3375
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   6495
      _ExtentX        =   11456
      _ExtentY        =   5953
      _Version        =   393216
      FixedCols       =   0
      BackColorFixed  =   -2147483639
      BackColorBkg    =   -2147483643
      FocusRect       =   2
      AllowUserResizing=   1
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   3960
      TabIndex        =   1
      Top             =   3600
      Width           =   1215
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Top             =   3600
      Width           =   1215
   End
End
Attribute VB_Name = "FindDlg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Private m_ReturnCode As ReturnCode
Private m_FindResult As String
Private m_CommandText As String
Private m_TableData As ADODB.Recordset

Private Sub CancelButton_Click()
Unload Me
End Sub

Private Sub Form_Load()
m_ReturnCode = RC_CANCET
RefreshReCode
DrawTable
ShowData
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set m_TableData = Nothing
End Sub



Private Sub m_Grid_DblClick()
If m_Grid.RowSel = 0 Then
   MsgBox "请选择", vbInformation Or vbOKOnly, "提示"
   Exit Sub
End If
m_FindResult = m_Grid.TextMatrix(m_Grid.RowSel, 0)
m_ReturnCode = RC_OK
Unload Me
End Sub

Private Sub OKButton_Click()

If m_Grid.RowSel = 0 Then
  MsgBox "请选择", vbInformation Or vbOKOnly, "提示"
   Exit Sub
End If
m_FindResult = m_Grid.TextMatrix(m_Grid.RowSel, 0)
m_ReturnCode = RC_OK
Unload Me
End Sub
Public Function DoModal(ByRef pComm As String) As ReturnCode
m_CommandText = pComm
Show vbModal
DoModal = m_ReturnCode
End Function
Private Sub DrawTable()
Dim i As Integer
m_Grid.Cols = m_TableData.Fields.COUNT
m_Grid.Rows = 1
m_Grid.Row = 0
m_Grid.RowHeight(0) = 400
For i = 0 To m_TableData.Fields.COUNT - 1
    m_Grid.ColAlignment(i) = 5
    m_Grid.Col = i
    m_Grid.Text = m_TableData.Fields(i).Name
Next i
End Sub
Private Sub ShowData()
Dim X As Long, Y As Long
Dim DataText As String

If Not (m_TableData.BOF And m_TableData.EOF) Then
   m_TableData.MoveFirst
End If
Y = 1
While Not m_TableData.EOF
     m_Grid.Rows = Y + 1
'    m_Grid.Row = y
     For X = 0 To m_TableData.Fields.COUNT - 1
         If IsNumeric(m_TableData.Fields(X).Value) Then
            DataText = CStr(m_TableData.Fields(X).Value)
         Else
         DataText = m_TableData.Fields(X).Value
         End If
'         m_Grid.Col = x
'         m_Grid.CellAlignment = vbAlignLeft Or vbAlignBottom
         m_Grid.TextMatrix(Y, X) = DataText
         If m_Grid.ColWidth(X) < TextWidth(DataText) Then m_Grid.ColWidth(X) = TextWidth(DataText) + 1000
  '   MsgBox TextWidth(DataText)
     Next X
     m_TableData.MoveNext
     Y = Y + 1
Wend
End Sub
Private Sub RefreshReCode()
If g_Conn Is Nothing Then
Set g_Conn = New ADODB.Connection
With g_Conn
    .Provider = g_Provider
    .CommandTimeout = 7
    .ConnectionTimeout = 10
    .Open g_DataSource
End With
End If
If g_Conn.State = adStateClosed Then
   g_Conn.Open g_DataSource
End If
Set m_TableData = g_Conn.Execute(m_CommandText)
End Sub
Public Property Get FindResult() As String
FindResult = m_FindResult
End Property

⌨️ 快捷键说明

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