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

📄 form1.frm

📁 用C语言如何编写多元线性回归
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form1 
   Caption         =   "使用绑定控件录入、修改、删除记录"
   ClientHeight    =   3510
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5850
   LinkTopic       =   "Form1"
   ScaleHeight     =   3510
   ScaleWidth      =   5850
   StartUpPosition =   1  '所有者中心
   Begin VB.Frame Frame1 
      Caption         =   "部门信息"
      Height          =   1995
      Left            =   45
      TabIndex        =   0
      Top             =   450
      Width           =   5745
      Begin VB.TextBox Text1 
         DataField       =   "部门编号"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   285
         Index           =   0
         Left            =   1020
         TabIndex        =   5
         Top             =   390
         Width           =   1410
      End
      Begin VB.TextBox Text1 
         DataField       =   "部门名称"
         DataSource      =   "Adodc1"
         Height          =   285
         Index           =   1
         Left            =   3330
         TabIndex        =   4
         Top             =   405
         Width           =   2250
      End
      Begin VB.TextBox Text1 
         DataField       =   "负责人"
         DataSource      =   "Adodc1"
         Height          =   285
         Index           =   2
         Left            =   1020
         TabIndex        =   3
         Top             =   960
         Width           =   1410
      End
      Begin VB.TextBox Text1 
         DataField       =   "部门电话"
         DataSource      =   "Adodc1"
         Height          =   285
         Index           =   3
         Left            =   3315
         TabIndex        =   2
         Top             =   960
         Width           =   2250
      End
      Begin VB.TextBox Text1 
         DataField       =   "部门职能"
         DataSource      =   "Adodc1"
         Height          =   285
         Index           =   4
         Left            =   1020
         TabIndex        =   1
         Top             =   1515
         Width           =   4560
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Height          =   240
         Left            =   135
         TabIndex        =   11
         Top             =   435
         Width           =   930
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "部门编号:"
         ForeColor       =   &H000000FF&
         Height          =   240
         Index           =   0
         Left            =   120
         TabIndex        =   10
         Top             =   450
         Width           =   945
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "部门名称:"
         ForeColor       =   &H000000FF&
         Height          =   240
         Index           =   1
         Left            =   2475
         TabIndex        =   9
         Top             =   450
         Width           =   945
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "负 责 人:"
         Height          =   240
         Index           =   2
         Left            =   120
         TabIndex        =   8
         Top             =   990
         Width           =   945
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "部门电话:"
         Height          =   240
         Index           =   3
         Left            =   2460
         TabIndex        =   7
         Top             =   990
         Width           =   945
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "部门职能:"
         Height          =   240
         Index           =   4
         Left            =   120
         TabIndex        =   6
         Top             =   1560
         Width           =   945
      End
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   60
      Top             =   2505
      Width           =   5745
      _ExtentX        =   10134
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      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         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      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 VB.Frame Frame2 
      Height          =   660
      Left            =   45
      TabIndex        =   12
      Top             =   2820
      Width           =   3690
      Begin VB.CommandButton CmdSave 
         Caption         =   "保存"
         Height          =   360
         Left            =   2730
         TabIndex        =   16
         Top             =   195
         Width           =   885
      End
      Begin VB.CommandButton CmdDelete 
         Caption         =   "删除"
         Height          =   360
         Left            =   1845
         TabIndex        =   15
         Top             =   195
         Width           =   885
      End
      Begin VB.CommandButton CmdModify 
         Caption         =   "修改"
         Height          =   360
         Left            =   960
         TabIndex        =   14
         Top             =   195
         Width           =   885
      End
      Begin VB.CommandButton CmdAdd 
         Caption         =   "添加"
         Height          =   360
         Left            =   75
         TabIndex        =   13
         Top             =   195
         Width           =   885
      End
   End
   Begin VB.Frame Frame3 
      Height          =   660
      Left            =   3705
      TabIndex        =   17
      Top             =   2820
      Width           =   2100
      Begin VB.CommandButton CmdExit 
         Caption         =   "退出"
         Height          =   360
         Left            =   105
         TabIndex        =   18
         Top             =   195
         Width           =   1905
      End
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "部门信息管理"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   240
      Left            =   2220
      TabIndex        =   19
      Top             =   105
      Width           =   1515
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
 '建立数据源的连接
 Adodc1.ConnectionString = "driver={SQL Server};server=.;database=test;uid=sa;pid=;"
 '查询所有记录,并按"部门编号"排序
 Adodc1.RecordSource = "select * from 部门信息表 order by 部门编号"
 Adodc1.Refresh
 For i = 0 To 4
  Text1(i).Enabled = False
 Next i
 CmdSave.Enabled = False
End Sub
Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
 Select Case Index
  Case Is = Index
    If KeyCode = vbKeyReturn And Index < 4 Then Text1(Index + 1).SetFocus '回车获得焦点
    If KeyCode = vbKeyReturn And Index = 4 Then CmdSave.SetFocus
    If KeyCode = vbKeyUp And Index > 1 Then Text1(Index - 1).SetFocus
 End Select
End Sub
Private Sub CmdAdd_Click()     '添加记录
 Adodc1.Recordset.AddNew
 For i = 0 To 4
   Text1(i).Enabled = True
   Text1(i).Text = ""
 Next i
 Text1(0).SetFocus
 CmdAdd.Enabled = False
 CmdDelete.Enabled = False
 CmdModify.Enabled = False
 CmdSave.Enabled = True
End Sub
Private Sub CmdModify_Click()     '修改记录
 If Adodc1.Recordset.RecordCount <> 0 Then
   For i = 0 To 4
     Text1(i).Enabled = True
   Next i
   CmdSave.Enabled = True
   CmdAdd.Enabled = False
   CmdModify.Enabled = False
   CmdDelete.Enabled = False
 Else
   MsgBox ("没有要修改的数据!")
 End If
End Sub
Private Sub CmdDelete_Click()     '删除记录
 Dim myval As String
 myval = MsgBox("是否要删除该记录?", vbYesNo)
 If myval = vbYes Then
  Adodc1.Recordset.Delete
  Adodc1.Recordset.MoveNext
  If Adodc1.Recordset.EOF = True Then Adodc1.Recordset.MoveLast
    For i = 0 To 4
        Text1(i).Enabled = False
    Next i
 End If
End Sub
Private Sub CmdSave_Click()
 If Text1(0).Text = "" Then
   MsgBox "部门编号不允许为空!"
   Exit Sub
 End If
 If Text1(1).Text = "" Then
   MsgBox "部门名称不允许为空!"
   Exit Sub
 End If
 If Text1(2).Text = "" Then
   MsgBox "负责人不允许为空!"
   Exit Sub
 End If
 If Text1(3).Text = "" Then
   MsgBox "部门电话不允许为空!"
   Exit Sub
 End If
 If Text1(4).Text = "" Then
   MsgBox "部门职能不允许为空!"
   Exit Sub
 End If
 Adodc1.Recordset.Update     '更新记录
 '设置控件不可用
 For i = 0 To 4
     Text1(i).Enabled = False
 Next i
 CmdSave.Enabled = False
 CmdAdd.Enabled = True
 CmdModify.Enabled = True
 CmdDelete.Enabled = True
End Sub
Private Sub CmdExit_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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