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

📄 frmlj.frm

📁 车辆管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmLJ 
   Caption         =   "车辆添加零件"
   ClientHeight    =   3120
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5025
   ForeColor       =   &H80000001&
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   3120
   ScaleWidth      =   5025
   Begin VB.CommandButton Command1 
      Caption         =   "尾记录"
      Height          =   330
      Index           =   3
      Left            =   2955
      TabIndex        =   14
      Top             =   840
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "首记录"
      Height          =   330
      Index           =   0
      Left            =   30
      TabIndex        =   13
      Top             =   840
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "下一条"
      Height          =   330
      Index           =   2
      Left            =   1980
      TabIndex        =   12
      Top             =   840
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "上一条"
      Height          =   330
      Index           =   1
      Left            =   1005
      TabIndex        =   11
      Top             =   840
      Width           =   975
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "frmLJ.frx":0000
      Height          =   1470
      Left            =   90
      TabIndex        =   10
      Top             =   1605
      Width           =   4785
      _ExtentX        =   8440
      _ExtentY        =   2593
      _Version        =   393216
      AllowUpdate     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      FormatLocked    =   -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 
            ColumnWidth     =   3374.929
         EndProperty
         BeginProperty Column01 
            ColumnWidth     =   959.811
         EndProperty
      EndProperty
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添 加(&A)"
      Height          =   330
      Left            =   30
      TabIndex        =   9
      Top             =   1170
      Width           =   975
   End
   Begin VB.CommandButton cmdok 
      Caption         =   "确 定(&O)"
      Enabled         =   0   'False
      Height          =   330
      Left            =   2955
      TabIndex        =   8
      Top             =   1170
      Width           =   975
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取 消(&Q)"
      Enabled         =   0   'False
      Height          =   330
      Left            =   3930
      TabIndex        =   7
      Top             =   1170
      Width           =   975
   End
   Begin VB.CommandButton cmdUpdate 
      Caption         =   "修 改(&U)"
      Height          =   330
      Left            =   1005
      TabIndex        =   6
      Top             =   1170
      Width           =   975
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "删 除(&D)"
      Height          =   330
      Left            =   1980
      TabIndex        =   5
      Top             =   1170
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "汽车零件信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000001&
      Height          =   765
      Left            =   30
      TabIndex        =   0
      Top             =   75
      Width           =   4860
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   330
         Left            =   3990
         Top             =   -180
         Visible         =   0   'False
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   582
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   2
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   12632256
         ForeColor       =   -2147483647
         Orientation     =   0
         Enabled         =   -1
         Connect         =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
         OLEDBString     =   "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=clgl.mdb;Persist Security Info=False"
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   "零件表"
         Caption         =   "     浏览零件信息"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
      Begin VB.TextBox Text2 
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   300
         Left            =   3555
         TabIndex        =   4
         Top             =   330
         Width           =   1200
      End
      Begin VB.TextBox Text1 
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   300
         Left            =   990
         TabIndex        =   3
         Top             =   330
         Width           =   1935
      End
      Begin VB.Label Label2 
         Caption         =   "单价:"
         Height          =   210
         Left            =   3000
         TabIndex        =   2
         Top             =   330
         Width           =   540
      End
      Begin VB.Label Label1 
         Caption         =   "零件名称:"
         Height          =   225
         Left            =   105
         TabIndex        =   1
         Top             =   330
         Width           =   930
      End
   End
End
Attribute VB_Name = "frmLJ"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Private Sub Lockctl()
   Text1.Enabled = False
   Text2.Enabled = False
End Sub
Private Sub Unlockctl()
   Text1.Enabled = True
   Text2.Enabled = True
End Sub
Private Sub cmdAdd_Click()
    Unlockctl
    Text1 = ""
    Text2 = ""
    Text1.SetFocus
    cmdok.Enabled = True
    cmdCancel.Enabled = True
    cmdUpdate.Enabled = False
    cmdDelete.Enabled = False
    i = 1
    Adodc1.Enabled = False
End Sub
Private Sub cmdCancel_Click()
    On Error Resume Next     '当没有添加数据的时候 处理异常
    Adodc1.Recordset.CancelUpdate
    Adodc1.Refresh
    Lockctl
    cmdCancel.Enabled = False
    cmdok.Enabled = False
    cmdAdd.Enabled = True
    cmdUpdate.Enabled = True
    cmdDelete.Enabled = True
    Adodc1.Enabled = True
End Sub

Private Sub cmdDelete_Click()
    If MsgBox("您确实要删除记录吗?", vbOKCancel, "系统提示") = vbOK Then
        On Error Resume Next
'        adoCon.Execute ("delete from 车辆违章表 where 零件名='" & Text1 & "'")
         Adodc1.Recordset.Delete
        MsgBox " 记录已删除!", , "系统提示"
        Adodc1.Refresh
    End If
    Text1.Text = ""
    Text2.Text = ""
End Sub
Private Sub cmdOk_Click()
    Select Case i
        Case 1
            If Text1 = "" Then
                MsgBox "零件名称不能为空!", , "系统提示"
                Text1.SetFocus
                Exit Sub
            End If
            If Text2 = "" Then
                MsgBox "价格不能为空!", , "系统提示"
                Text2.SetFocus
                Exit Sub
            End If
            adoCon.Execute ("insert into 零件表 values ('" & Text1 & "','" & Text2 & "')")
            MsgBox "记录添加成功!", , "系统提示"
        Case 2
        adoCon.Execute ("update 零件表 set 单价='" & Text2 & "'where 零件名='" + Text1.Text + "'")
            MsgBox "记录修改成功!", , "系统提示"
    End Select
    Lockctl
    cmdok.Enabled = False
    cmdCancel.Enabled = False
    cmdAdd.Enabled = True
    cmdUpdate.Enabled = True
    cmdDelete.Enabled = True
    Adodc1.Refresh
    DataGrid1.Refresh
End Sub
Private Sub cmdUpdate_Click()
    Unlockctl
    i = 2
    Text1.Enabled = False
    cmdok.Enabled = True
    cmdCancel.Enabled = True
    cmdAdd.Enabled = False
    cmdDelete.Enabled = False
    Adodc1.Enabled = False
End Sub

Private Sub Command1_Click(Index As Integer)
  On Error Resume Next
  Select Case Index
         Case 0
         Adodc1.Recordset.MoveFirst
         Case 1
         If Adodc1.Recordset.BOF = False Then
            Adodc1.Recordset.MovePrevious
         Else
            MsgBox "向前已经没有记录了!", , "系统提示"
         End If
         Case 2
         If Adodc1.Recordset.EOF = False Then
            Adodc1.Recordset.MoveNext
         Else
            MsgBox "向后已经没有记录了!", , "系统提示"
         End If
         Case 3
         Adodc1.Recordset.MoveLast
  End Select
  Text1.Text = Adodc1.Recordset.Fields(0)
  Text2.Text = Adodc1.Recordset.Fields(1)
End Sub

Private Sub Form_Load()
frmLJ.Width = 5145
frmLJ.Height = 3525
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
 If KeyAscii = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
  KeyAscii = valiText(KeyAscii, "0123456789" & Chr(8), True)
End Sub

⌨️ 快捷键说明

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