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

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form1 
   Caption         =   "连接 dbf 数据库"
   ClientHeight    =   4320
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   8115
   LinkTopic       =   "Form1"
   ScaleHeight     =   4320
   ScaleWidth      =   8115
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   390
      Left            =   5640
      TabIndex        =   7
      Top             =   3780
      Width           =   2370
   End
   Begin VB.Frame Frame1 
      Caption         =   "录入窗口"
      Height          =   3285
      Left            =   5610
      TabIndex        =   1
      Top             =   390
      Width           =   2415
      Begin VB.CommandButton Command3 
         Caption         =   "删除"
         Height          =   390
         Left            =   210
         TabIndex        =   9
         Top             =   2820
         Width           =   2055
      End
      Begin VB.CommandButton Command2 
         Caption         =   "添加"
         Height          =   390
         Left            =   210
         TabIndex        =   5
         Top             =   2430
         Width           =   2055
      End
      Begin VB.TextBox Text2 
         Height          =   345
         Index           =   0
         Left            =   135
         TabIndex        =   4
         Top             =   555
         Width           =   2235
      End
      Begin VB.TextBox Text2 
         Height          =   360
         Index           =   1
         Left            =   150
         TabIndex        =   3
         Top             =   1245
         Width           =   2235
      End
      Begin VB.TextBox Text2 
         Height          =   360
         Index           =   2
         Left            =   135
         TabIndex        =   2
         Top             =   2010
         Width           =   2235
      End
      Begin VB.Label Label1 
         Caption         =   "药品名称:                                拼音简码:                                商品产地:"
         Height          =   2340
         Left            =   150
         TabIndex        =   6
         Top             =   270
         Width           =   960
      End
   End
   Begin MSDBGrid.DBGrid DBGrid1 
      Bindings        =   "Form1.frx":0000
      Height          =   2790
      Left            =   150
      OleObjectBlob   =   "Form1.frx":0014
      TabIndex        =   0
      Top             =   840
      Width           =   5265
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   390
      Left            =   150
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3750
      Width           =   5325
   End
   Begin VB.Label Label2 
      Caption         =   "药品信息列表"
      Height          =   315
      Left            =   2070
      TabIndex        =   8
      Top             =   480
      Width           =   1695
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim db As Database
Dim RS As Recordset
Private Sub Form_Load()
  Set db = OpenDatabase(App.Path & "\", False, False, "FOXPRO 2.5;")
  Set RS = db.OpenRecordset("SJ")
  Set Data1.Recordset = RS
  Data1.Refresh
End Sub
Private Sub Form_Activate()
  DBGrid1.Columns(0).Width = 400
  DBGrid1.Columns(1).Width = 1500
  DBGrid1.Columns(2).Width = 1200
  DBGrid1.Columns(3).Width = 1500
End Sub
Private Sub Text2_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If KeyCode = vbKeyReturn Then
     Select Case Index
        Case 2
            Command2.SetFocus
        Case 1
           Text2(2).SetFocus
        Case 0
           Text2(1).SetFocus
     End Select
  End If
  If KeyCode = vbKeyLeft Then
     Select Case i
        Case 2
           Text2(1).SetFocus
        Case 1
           Text2(0).SetFocus
     End Select
  End If
End Sub
Private Sub Command2_Click()
  RS.AddNew
  RS.Fields(1).Value = Text2(0).Text
  RS.Fields(2).Value = Text2(1).Text
  RS.Fields(3).Value = Text2(2).Text
  RS.Update
  RS.Close
  For i = 0 To 2
      Text2(i) = ""
  Next i
  Data1.Refresh
  DBGrid1.Columns(0).Width = 400
  DBGrid1.Columns(1).Width = 1500
  DBGrid1.Columns(2).Width = 1200
  DBGrid1.Columns(3).Width = 1500
End Sub
Private Sub Command3_Click()
  On Error Resume Next
  Data1.Recordset.Delete
End Sub
Private Sub Command1_Click()
  End
End Sub

⌨️ 快捷键说明

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