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

📄 frmteacher.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 frmTeacher 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "教师档案管理"
   ClientHeight    =   6270
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11835
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6270
   ScaleWidth      =   11835
   StartUpPosition =   2  '屏幕中心
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "frmTeacher.frx":0000
      Height          =   4815
      Left            =   120
      TabIndex        =   8
      Top             =   600
      Width           =   11535
      _ExtentX        =   20346
      _ExtentY        =   8493
      _Version        =   393216
      AllowUpdate     =   0   'False
      HeadLines       =   1
      RowHeight       =   15
      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 VB.TextBox txtName 
      Height          =   375
      Left            =   5520
      TabIndex        =   7
      Top             =   120
      Width           =   2415
   End
   Begin MSAdodcLib.Adodc Adodc2 
      Height          =   375
      Left            =   360
      Top             =   5760
      Visible         =   0   'False
      Width           =   2295
      _ExtentX        =   4048
      _ExtentY        =   661
      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         =   "Adodc2"
      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 MSAdodcLib.Adodc Adodc1 
      Height          =   375
      Left            =   10080
      Top             =   120
      Visible         =   0   'False
      Width           =   1680
      _ExtentX        =   2963
      _ExtentY        =   661
      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         =   "Adodc1"
      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.TextBox txtIdendity 
      Height          =   375
      Left            =   1800
      TabIndex        =   5
      Top             =   120
      Width           =   2415
   End
   Begin VB.CommandButton Command4 
      Caption         =   "返回"
      Height          =   375
      Left            =   9120
      TabIndex        =   3
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton btnDel 
      Caption         =   "删除教师信息"
      Height          =   375
      Left            =   7560
      TabIndex        =   2
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton btnModi 
      Caption         =   "修改教师信息"
      Height          =   375
      Left            =   6000
      TabIndex        =   1
      Top             =   5640
      Width           =   1335
   End
   Begin VB.CommandButton btnAdd 
      Caption         =   "添加教师信息"
      Height          =   375
      Left            =   4440
      TabIndex        =   0
      Top             =   5640
      Width           =   1335
   End
   Begin VB.Label Label4 
      AutoSize        =   -1  'True
      Caption         =   "教师姓名"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   210
      Left            =   4560
      TabIndex        =   6
      Top             =   240
      Width           =   900
   End
   Begin VB.Label Label23 
      AutoSize        =   -1  'True
      Caption         =   "教师工号"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   210
      Left            =   240
      TabIndex        =   4
      Top             =   240
      Width           =   900
   End
End
Attribute VB_Name = "frmTeacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False







Private Sub btnAdd_Click()

frmTeacherEdit.modify = False

frmTeacherEdit.Show 1

End Sub

Private Sub btnDel_Click()

If Adodc2.Recordset.EOF = True Then
MsgBox "请选择一条要删除的纪录!", vbInformation
Exit Sub
End If

 If MsgBox("确认要删除记录?", vbQuestion + vbYesNo) = vbNo Then
Exit Sub
Else
'删除记录
CurTeacher.Teacher_Id = Adodc2.Recordset.Fields(0)
MyTeacher.Delete (CurTeacher.Teacher_Id)
MsgBox "删除记录成功!", vbInformation
'刷新datagrid

Call Refresh_Datagrid

End If

End Sub

Private Sub btnModi_Click()
frmTeacherEdit.modify = True
If Adodc2.Recordset.EOF = True Then
MsgBox "请选择一条记录!", vbExclamation
Exit Sub
End If

With frmTeacherEdit
.txtName.Text = Adodc2.Recordset.Fields(2)
.cboSex.ListIndex = ConvertSex(Adodc2.Recordset.Fields(3))
.txtBirth.Text = Adodc2.Recordset.Fields(4)
.txtWage.Text = Adodc2.Recordset.Fields(5)
.txtIdendity.Text = Adodc2.Recordset.Fields(1)
.txtNation.Text = Adodc2.Recordset.Fields(6)
.cboDip.ListIndex = ConvertDip(Adodc2.Recordset.Fields(7))
.txtTel.Text = Adodc2.Recordset.Fields(8) & ""
.txtAdress.Text = Adodc2.Recordset.Fields(9) & ""
.txtWork.Text = Adodc2.Recordset.Fields(10) & ""
.txtPC.Text = Adodc2.Recordset.Fields(11) & ""
.rtMemo.Text = Adodc2.Recordset.Fields(12) & ""
CurTeacher.Teacher_Id = Adodc2.Recordset.Fields(0)

End With
frmTeacherEdit.Show 1
End Sub

Private Function ConvertSex(ByVal sex As String) As Integer
Select Case sex

Case Is = "男"
ConvertSex = 0
Case Is = "女"
ConvertSex = 1
Case Else

End Select

End Function

Private Function ConvertDip(ByVal dip As String) As Integer

Select Case dip

Case Is = "专科"
ConvertDip = 0
Case Is = "本科"
ConvertDip = 1
Case Is = "硕士"
ConvertDip = 2
Case Is = "博士"
ConvertDip = 3
Case Else

End Select
End Function

Private Sub Command4_Click()
Unload Me
End Sub


Public Sub Refresh_Datagrid()

Adodc2.ConnectionString = conn
Adodc2.RecordSource = "select teacher_id,teacher_Idendity as 教师工号,teacher_name as 教师姓名,teacher_sex as 性别,teacher_birth as 出生日期,teacher_workage as 教师工龄,teacher_nation as 教师籍贯,teacher_dip as 学历,teacher_tel as 电话号码,teacher_adress as 家庭住址,teacher_title as 职务,PostCode as 邮政编码,teacher_memo as 备注 from teacherInfo where teacher_Idendity like '%" & MakeStr(Trim(txtIdendity.Text)) & "%' and " _
                      + "teacher_name like '%" + MakeStr(Trim(txtName.Text)) + "%'"

Adodc2.Refresh

With DataGrid1
.Columns(0).Width = 0
.Columns(1).Width = 1500
.Columns(2).Width = 1500
.Columns(3).Width = 800
.Columns(4).Width = 1000
.Columns(5).Width = 800
.Columns(6).Width = 2000
.Columns(7).Width = 800
.Columns(8).Width = 2000
.Columns(9).Width = 2000
.Columns(10).Width = 2000
.Columns(11).Width = 800
.Columns(12).Width = 2000

End With

End Sub

Private Sub Form_Load()

Call Refresh_Datagrid

End Sub


Private Sub txtIdendity_Change()
Call Refresh_Datagrid
End Sub

Private Sub txtName_Change()
Call Refresh_Datagrid
End Sub

⌨️ 快捷键说明

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