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

📄 frmclientinfo.frm

📁 有一些基本的操作
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmClientInfo 
   Caption         =   "客户资料维护"
   ClientHeight    =   6180
   ClientLeft      =   1110
   ClientTop       =   345
   ClientWidth     =   7725
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   6180
   ScaleWidth      =   7725
   Begin VB.CommandButton btnSearch 
      Caption         =   "查询"
      Height          =   375
      Left            =   3600
      TabIndex        =   2
      Top             =   600
      Width           =   735
   End
   Begin VB.TextBox txbGoodPY 
      Height          =   375
      Left            =   1080
      TabIndex        =   1
      Top             =   600
      Width           =   2295
   End
   Begin MSDataGridLib.DataGrid grdDataGrid 
      Align           =   2  'Align Bottom
      Bindings        =   "frmClientInfo.frx":0000
      Height          =   4335
      Left            =   0
      TabIndex        =   0
      Top             =   1515
      Width           =   7725
      _ExtentX        =   13626
      _ExtentY        =   7646
      _Version        =   393216
      AllowUpdate     =   -1  'True
      HeadLines       =   1
      RowHeight       =   15
      AllowAddNew     =   -1  'True
      AllowDelete     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc datPrimaryRS 
      Align           =   2  'Align Bottom
      Height          =   330
      Left            =   0
      Top             =   5850
      Visible         =   0   'False
      Width           =   7725
      _ExtentX        =   13626
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   2
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jxclink"
      OLEDBString     =   "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jxclink"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   $"frmClientInfo.frx":001B
      Caption         =   " "
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   6840
      Top             =   600
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   2
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClientInfo.frx":00B7
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "frmClientInfo.frx":01C9
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   420
      Left            =   0
      TabIndex        =   3
      Top             =   0
      Width           =   7725
      _ExtentX        =   13626
      _ExtentY        =   741
      ButtonWidth     =   609
      ButtonHeight    =   582
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   2
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "btnSave"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "btnDelete"
            ImageIndex      =   2
         EndProperty
      EndProperty
   End
   Begin VB.Label lblGoodsPY 
      Caption         =   "客户拼音"
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   720
      Width           =   735
   End
End
Attribute VB_Name = "frmClientInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub btnSearch_Click()
    Dim strSQL As String
    strSQL = "SELECT 客户编号, 拼音编码, 简称, 名称, " & _
            "联系人, 地址, 邮编, 区号, 地区, 电话, 传真, " & _
            "电报, 开户行, 开户行邮编, 银行帐号, 税号, " & _
            "性质, 业务员, 业务部门, 授信额度 FROM 客户清单"
    If Len(txbGoodPY.Text) <> 0 Then
        '如果商品拼音不为空进行查询
        '生成查询的SQL语句
        strSQL = strSQL & " where 拼音编码 like '"
        strSQL = strSQL & Trim(txbGoodPY.Text) & "%'"
    End If
    '重新填充DataGrid
    datPrimaryRS.RecordSource = strSQL
    datPrimaryRS.Refresh
End Sub


Private Sub Form_Load()
    Dim db As New DataBases
    datPrimaryRS.ConnectionString = db.sConn
End Sub

Private Sub Form_Resize()
  On Error Resume Next
  '当窗体调整时会调整网格
  grdDataGrid.Height = Me.ScaleHeight - datPrimaryRS.Height - 1000
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Screen.MousePointer = vbDefault
End Sub

Private Sub datPrimaryRS_Error(ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)
  '错误处理程序代码置于此处
  '想要忽略错误,注释掉下一行
  '想要捕获它们,在此添加代码以处理它们
  MsgBox "Data error event hit err:" & Description
End Sub

Private Sub datPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  '验证代码置于此处
  '下列动作发生时该事件被调用
  Dim bCancel As Boolean

  Select Case adReason
  Case adRsnAddNew
  Case adRsnClose
  Case adRsnDelete
  Case adRsnFirstChange
  Case adRsnMove
  Case adRsnRequery
  Case adRsnResynch
  Case adRsnUndoAddNew
  Case adRsnUndoDelete
  Case adRsnUndoUpdate
  Case adRsnUpdate
  End Select

  If bCancel Then adStatus = adStatusCancel
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    '判断按下的是否为“Save”按钮
    If StrComp(Button.Key, "btnSave") = 0 Then
        '判断grdDataGrid的数据是否有变化
        '即DataGrid控件上是否有数据更改或新增数据
        If grdDataGrid.DataChanged Then
            '通过datPrimaryRS更新数据库数据
            datPrimaryRS.Recordset.UpdateBatch adAffectAll
            MsgBox "数据修改成功"
        Else
            MsgBox "无修改的数据"
        End If
    '判断按下的是否为“Delete”按钮
    ElseIf StrComp(Button.Key, "btnDelete") = 0 Then
        '获得DataGrid当前被选中的行号
        iRow = grdDataGrid.Row
        '弹出对话框让用户确认要删除记录
        '如果用户确认要删除记录
        If MsgBox("你确认要删除此条记录码?", vbYesNo) = vbYes Then
            '从商品清单表删除当前被选中记录
            With datPrimaryRS.Recordset
                .Delete
                .MoveNext
                If .EOF Then .MoveLast
            End With
        End If
    End If
End Sub


⌨️ 快捷键说明

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