www.pudn.com > textmanager.rar > FrmStudent.frm, change:2005-04-12,size:16826b


VERSION 5.00 
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX" 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Begin VB.Form FrmStudent  
   Caption         =   "学生信息录入" 
   ClientHeight    =   8595 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   11880 
   LinkTopic       =   "Form1" 
   LockControls    =   -1  'True 
   ScaleHeight     =   8595 
   ScaleWidth      =   11880 
   Begin VB.Frame Frame3  
      Caption         =   "学生信息" 
      Height          =   7365 
      Left            =   75 
      TabIndex        =   0 
      Top             =   30 
      Width           =   11790 
      Begin VB.Frame Frame8  
         Caption         =   "编辑" 
         Height          =   1155 
         Left            =   10065 
         TabIndex        =   9 
         Top             =   345 
         Width           =   1605 
         Begin VB.CommandButton CmdNew  
            Appearance      =   0  'Flat 
            Height          =   300 
            Left            =   120 
            Picture         =   "FrmStudent.frx":0000 
            Style           =   1  'Graphical 
            TabIndex        =   13 
            ToolTipText     =   "添加考生信息" 
            Top             =   465 
            Width           =   645 
         End 
         Begin VB.CommandButton CmdEdit  
            Appearance      =   0  'Flat 
            Height          =   300 
            Left            =   855 
            Picture         =   "FrmStudent.frx":006E 
            Style           =   1  'Graphical 
            TabIndex        =   12 
            ToolTipText     =   "编辑考生信息" 
            Top             =   465 
            Width           =   645 
         End 
         Begin VB.CommandButton CmdDel  
            Appearance      =   0  'Flat 
            Height          =   300 
            Left            =   390 
            Picture         =   "FrmStudent.frx":00F8 
            Style           =   1  'Graphical 
            TabIndex        =   11 
            ToolTipText     =   "删除该考生信息" 
            Top             =   810 
            Width           =   900 
         End 
         Begin VB.CheckBox CheQK  
            Appearance      =   0  'Flat 
            Caption         =   "添加时清空" 
            ForeColor       =   &H80000008& 
            Height          =   195 
            Left            =   210 
            TabIndex        =   10 
            Top             =   225 
            Value           =   1  'Checked 
            Width           =   1200 
         End 
      End 
      Begin MSDataGridLib.DataGrid DGKaosheng  
         Height          =   5520 
         Left            =   3030 
         TabIndex        =   2 
         Top             =   1695 
         Width           =   8655 
         _ExtentX        =   15266 
         _ExtentY        =   9737 
         _Version        =   393216 
         AllowUpdate     =   0   'False 
         ForeColor       =   -2147483635 
         HeadLines       =   1 
         RowHeight       =   18 
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            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  
            MarqueeStyle    =   3 
            BeginProperty Column00  
            EndProperty 
            BeginProperty Column01  
            EndProperty 
         EndProperty 
      End 
      Begin VB.Frame Frame1  
         Caption         =   "录入学生基本信息" 
         Height          =   1335 
         Left            =   3015 
         TabIndex        =   1 
         Top             =   225 
         Width           =   8700 
         Begin VB.Frame FramIn  
            Enabled         =   0   'False 
            Height          =   1020 
            Left            =   105 
            TabIndex        =   3 
            Top             =   225 
            Width           =   6975 
            Begin VB.TextBox TxTKe  
               Appearance      =   0  'Flat 
               Enabled         =   0   'False 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   10.5 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   3420 
               TabIndex        =   20 
               Top             =   630 
               Width           =   1920 
            End 
            Begin VB.Frame Frame2  
               Caption         =   "性别" 
               Height          =   465 
               Left            =   4560 
               TabIndex        =   15 
               Top             =   135 
               Width           =   1740 
               Begin VB.OptionButton OptNv  
                  Caption         =   "女" 
                  Height          =   210 
                  Left            =   1095 
                  TabIndex        =   17 
                  Top             =   195 
                  Width           =   585 
               End 
               Begin VB.OptionButton OptNan  
                  Caption         =   "男" 
                  Height          =   210 
                  Left            =   510 
                  TabIndex        =   16 
                  Top             =   195 
                  Value           =   -1  'True 
                  Width           =   585 
               End 
            End 
            Begin VB.TextBox TXTJu  
               Appearance      =   0  'Flat 
               Enabled         =   0   'False 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   10.5 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   735 
               TabIndex        =   14 
               Top             =   630 
               Width           =   1920 
            End 
            Begin VB.TextBox TXTName  
               Appearance      =   0  'Flat 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   10.5 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   2520 
               TabIndex        =   7 
               Top             =   210 
               Width           =   1455 
            End 
            Begin VB.TextBox TXTBianhao  
               Appearance      =   0  'Flat 
               BeginProperty Font  
                  Name            =   "宋体" 
                  Size            =   10.5 
                  Charset         =   134 
                  Weight          =   400 
                  Underline       =   0   'False 
                  Italic          =   0   'False 
                  Strikethrough   =   0   'False 
               EndProperty 
               Height          =   315 
               Left            =   735 
               TabIndex        =   5 
               Top             =   225 
               Width           =   1200 
            End 
            Begin VB.Label Label5  
               Caption         =   "科室:" 
               Height          =   210 
               Left            =   2850 
               TabIndex        =   19 
               Top             =   690 
               Width           =   540 
            End 
            Begin VB.Label Label6  
               Caption         =   "分局:" 
               Height          =   240 
               Left            =   210 
               TabIndex        =   18 
               Top             =   690 
               Width           =   540 
            End 
            Begin VB.Label Label2  
               Caption         =   "姓名:" 
               Height          =   240 
               Left            =   1995 
               TabIndex        =   6 
               Top             =   270 
               Width           =   600 
            End 
            Begin VB.Label Label1  
               Caption         =   "编号:" 
               Height          =   240 
               Left            =   225 
               TabIndex        =   4 
               Top             =   285 
               Width           =   600 
            End 
         End 
      End 
      Begin MSComctlLib.TreeView TrVzilei  
         Height          =   6900 
         Left            =   90 
         TabIndex        =   8 
         Top             =   315 
         Width           =   2820 
         _ExtentX        =   4974 
         _ExtentY        =   12171 
         _Version        =   393217 
         Indentation     =   460 
         LabelEdit       =   1 
         LineStyle       =   1 
         Style           =   7 
         ImageList       =   "ImgLst" 
         BorderStyle     =   1 
         Appearance      =   0 
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}  
            Name            =   "宋体" 
            Size            =   12 
            Charset         =   134 
            Weight          =   400 
            Underline       =   0   'False 
            Italic          =   0   'False 
            Strikethrough   =   0   'False 
         EndProperty 
      End 
   End 
   Begin MSComctlLib.ImageList ImgLst  
      Left            =   3315 
      Top             =   7785 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   20 
      ImageHeight     =   20 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   7 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":0187 
            Key             =   "save" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":021B 
            Key             =   "undo" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":028B 
            Key             =   "new" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":030B 
            Key             =   "edit" 
         EndProperty 
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":03A7 
            Key             =   "student" 
         EndProperty 
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":07FB 
            Key             =   "grade" 
         EndProperty 
         BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "FrmStudent.frx":0C4F 
            Key             =   "class" 
         EndProperty 
      EndProperty 
   End 
End 
Attribute VB_Name = "FrmStudent" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Option Explicit 
'标志是添加还是编辑 
Dim NewOrEdit As String 
 
'设置是否可以编辑 
Sub SetEnabled(ByVal TF As Boolean) 
  FramIn.Enabled = TF 
  CmdDel.Enabled = Not TF 
End Sub 
'清空 
Sub ClsXS() 
  TXTName = "" 
  TXTName.SetFocus 
  'TXTXuehao = "" 
  'TxTNum = "" 
   
End Sub 
'判断输入是否合格 
Function CheckIn() As Boolean 
  If TXTName = "" Then 
    MsgBox "请输入考生的姓名!" 
    TXTName.SetFocus 
    Exit Function 
  End If 
  If Val(TXTBianhao) <= 0 Then 
    MsgBox "请输入考生的编号!" 
    TXTBianhao.SetFocus 
    Exit Function 
  End If 
  If Val(TXTJu.Text) <= 0 Then 
    MsgBox "请输入考生所在的分局!" 
    TXTJu.SetFocus 
    Exit Function 
  End If 
 CheckIn = True 
End Function 
 
Private Sub CmdEdit_Click() 
  If CmdNew.ToolTipText = "添加考生信息" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存考生信息" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "Edit" 
 Else 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加考生信息" 
  CmdEdit.ToolTipText = "编辑考生信息" 
 End If 
 
End Sub 
 
Private Sub CmdNew_Click() 
 If CmdNew.ToolTipText = "添加考生信息" Then 
  SetEnabled True 
  CmdNew.Picture = ImgLst.ListImages(1).Picture 
  CmdEdit.Picture = ImgLst.ListImages(2).Picture 
  CmdNew.ToolTipText = "保存考生信息" 
  CmdEdit.ToolTipText = "取消保存" 
  NewOrEdit = "New" 
  If CheQK.Value = 1 Then 
    '清空 
    ClsXS 
  End If 
 Else 
   
    '判断输入是否合格 
    If CheckIn = False Then 
       Exit Sub 
    End If 
    Dim SQL As String 
    Dim Sex As String 
    '判断是添加还是编辑 
    Sex = "男" 
    If OptNv.Value = True Then Sex = "女" 
    If NewOrEdit = "New" Then 
    '添加 
     SQL = "insert into student(name,sex,grade,class,sid,pass) values('" + TXTName.Text + "','" + Sex + "','" + TXTYear.Text + "'," + str(Val(CmbNum.Text)) + "," + TXTXuehao.Text + ",'')" 
     MsgBox SQL 
     DB.Execute SQL 
      
     Else 
     '更新 
    End If 
  SetEnabled False 
  CmdNew.Picture = ImgLst.ListImages(3).Picture 
  CmdEdit.Picture = ImgLst.ListImages(4).Picture 
  CmdNew.ToolTipText = "添加考生信息" 
  CmdEdit.ToolTipText = "编辑考生信息" 
 End If 
 
End Sub 
 
 
Private Sub Form_Load() 
 
 ' Dim adoRS As Recordset 
 ' Dim i As Integer 
 ' Dim MyNod As Node 
 ' Dim NewNod As Node 
 '显示年级信息 
 '打开记录集 
 ' Set adoRS = New Recordset 
 ' adoRS.Open "select * from zilei", DB, adOpenStatic, adLockOptimistic 
   '建立根接点 
 ' Set MyNod = TrVzilei.Nodes.Add(, , "node_n", "所有同学", "student") 
 ' Do While Not adoRS.EOF 
    '建立年级节点 
  '  Set NewNod = TrVzilei.Nodes.Add("node_n", tvwChild, "node_nj" + adoRS.Fields(0).Value, adoRS.Fields(1).Value, "grade") 
  '  For i = 1 To adoRS.Fields(2).Value 
      '建立班节点 
   '   Set NewNod = TrVzilei.Nodes.Add("node_nj" + adoRS.Fields(0).Value, tvwChild, "node_njc" + adoRS.Fields(1).Value + "|" + Trim(str(i)), Trim(str(i)) + "班", "class") 
    'Next i 
    'adoRS.MoveNext 
  'Loop 
     
  'adoRS.Close 
 
End Sub