www.pudn.com > xj1.rar > Form2.dat, change:2008-06-02,size:14816b


'个人信息窗体代码 
VERSION 5.00 
Begin VB.Form Form2  
   Caption         =   "实验考试系统" 
   ClientHeight    =   6300 
   ClientLeft      =   3405 
   ClientTop       =   2895 
   ClientWidth     =   5880 
   LinkTopic       =   "Form2" 
   MaxButton       =   0   'False 
   ScaleHeight     =   6300 
   ScaleWidth      =   5880 
   StartUpPosition =   2  '屏幕中心 
   Begin VB.Timer Timer2  
      Interval        =   100 
      Left            =   5400 
      Top             =   5280 
   End 
   Begin VB.Timer Timer1  
      Interval        =   1000 
      Left            =   360 
      Top             =   5280 
   End 
   Begin VB.TextBox Text3  
      Height          =   375 
      IMEMode         =   3  'DISABLE 
      Left            =   1320 
      MaxLength       =   16 
      PasswordChar    =   "*" 
      TabIndex        =   14 
      Top             =   4320 
      Width           =   2655 
   End 
   Begin VB.TextBox Text2  
      Height          =   375 
      IMEMode         =   3  'DISABLE 
      Left            =   1320 
      MaxLength       =   16 
      PasswordChar    =   "*" 
      TabIndex        =   12 
      Top             =   3720 
      Width           =   2655 
   End 
   Begin VB.CheckBox Check1  
      Caption         =   "设置新密码" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   375 
      Left            =   1320 
      TabIndex        =   13 
      Top             =   3120 
      Width           =   1815 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "退出" 
      Height          =   375 
      Left            =   4200 
      TabIndex        =   17 
      Top             =   4920 
      Width           =   975 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   5 
      Left            =   3960 
      TabIndex        =   11 
      Top             =   2520 
      Width           =   1575 
   End 
   Begin VB.CommandButton Command1  
      Cancel          =   -1  'True 
      Caption         =   "修改个人信息" 
      Height          =   375 
      Left            =   1080 
      TabIndex        =   15 
      Top             =   4920 
      Width           =   1335 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   4 
      Left            =   3960 
      TabIndex        =   10 
      Top             =   1680 
      Width           =   1575 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   3 
      Left            =   3960 
      TabIndex        =   9 
      Top             =   840 
      Width           =   1575 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   2 
      Left            =   1320 
      TabIndex        =   8 
      Top             =   2520 
      Width           =   1575 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   1 
      Left            =   1320 
      TabIndex        =   7 
      Top             =   1680 
      Width           =   1575 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   0 
      Left            =   1320 
      TabIndex        =   6 
      Top             =   840 
      Width           =   1575 
   End 
   Begin VB.CommandButton Command3  
      Caption         =   "开始考试" 
      Height          =   375 
      Left            =   2760 
      TabIndex        =   5 
      Top             =   4920 
      Width           =   1095 
   End 
   Begin VB.Label Label10  
      AutoSize        =   -1  'True 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   700 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   285 
      Left            =   1080 
      TabIndex        =   21 
      Top             =   5520 
      Visible         =   0   'False 
      Width           =   165 
   End 
   Begin VB.Label Label9  
      Caption         =   "温馨提示,若不设置新密码,则将密码默认为学号!" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      ForeColor       =   &H000000FF& 
      Height          =   255 
      Left            =   5280 
      TabIndex        =   20 
      Top             =   5880 
      Width           =   6495 
   End 
   Begin VB.Label Label8  
      AutoSize        =   -1  'True 
      Caption         =   "确 认" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   285 
      Left            =   360 
      TabIndex        =   19 
      Top             =   4320 
      Width           =   720 
   End 
   Begin VB.Label Label7  
      Caption         =   "新密码" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   375 
      Left            =   240 
      TabIndex        =   18 
      Top             =   3720 
      Width           =   855 
   End 
   Begin VB.Label Label6  
      AutoSize        =   -1  'True 
      Caption         =   "成绩" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   14.25 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   285 
      Left            =   3240 
      TabIndex        =   16 
      Top             =   2520 
      Width           =   570 
   End 
   Begin VB.Label Label5  
      AutoSize        =   -1  'True 
      Caption         =   "年龄" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   240 
      Left            =   3240 
      TabIndex        =   4 
      Top             =   1680 
      Width           =   480 
   End 
   Begin VB.Label Label4  
      AutoSize        =   -1  'True 
      Caption         =   "性别" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   240 
      Left            =   3240 
      TabIndex        =   3 
      Top             =   840 
      Width           =   480 
   End 
   Begin VB.Label Label3  
      AutoSize        =   -1  'True 
      Caption         =   "准考证" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   240 
      Left            =   360 
      TabIndex        =   2 
      Top             =   2520 
      Width           =   720 
   End 
   Begin VB.Label Label2  
      AutoSize        =   -1  'True 
      Caption         =   "学号" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   240 
      Left            =   600 
      TabIndex        =   1 
      Top             =   1680 
      Width           =   480 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "姓名" 
      BeginProperty Font  
         Name            =   "宋体" 
         Size            =   12 
         Charset         =   134 
         Weight          =   400 
         Underline       =   0   'False 
         Italic          =   0   'False 
         Strikethrough   =   0   'False 
      EndProperty 
      Height          =   240 
      Left            =   600 
      TabIndex        =   0 
      Top             =   840 
      Width           =   480 
   End 
   Begin VB.Menu file  
      Caption         =   "文件(&F)" 
      Begin VB.Menu unlogin  
         Caption         =   "注消登录" 
      End 
      Begin VB.Menu creat  
         Caption         =   "创建试题库" 
         Enabled         =   0   'False 
      End 
      Begin VB.Menu a  
         Caption         =   "-" 
      End 
      Begin VB.Menu exit  
         Caption         =   "退出" 
      End 
   End 
   Begin VB.Menu show  
      Caption         =   "显示(&A)" 
      Begin VB.Menu time  
         Caption         =   "系统时间(&T)" 
      End 
      Begin VB.Menu daima  
         Caption         =   "源代码" 
         Begin VB.Menu local  
            Caption         =   "当前窗口" 
         End 
         Begin VB.Menu all  
            Caption         =   "所有窗口" 
         End 
      End 
   End 
   Begin VB.Menu shouming  
      Caption         =   "说明(&S)" 
      Begin VB.Menu html  
         Caption         =   "网页说明" 
      End 
      Begin VB.Menu txt  
         Caption         =   "文本说明" 
      End 
   End 
   Begin VB.Menu chaxu  
      Caption         =   "查询(&C)" 
      Begin VB.Menu cx  
         Caption         =   "查询成绩" 
         Enabled         =   0   'False 
      End 
      Begin VB.Menu msg  
         Caption         =   "个人信息" 
         Enabled         =   0   'False 
      End 
   End 
   Begin VB.Menu help  
      Caption         =   "帮助(&H)" 
   End 
End 
Attribute VB_Name = "Form2" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim kaosheng  As people 
Private Sub all_Click() 
'读取所有源代码 
Call duma 
End Sub 
'复选框选中才可修改密码 
Private Sub Check1_Click() 
If Check1.Value = 1 Then 
Text2.Enabled = True 
Text3.Enabled = True 
Else 
Text2.Enabled = False 
Text3.Enabled = False 
End If 
End Sub 
 
Private Sub Command1_Click() 
If Command1.Caption = "修改个人信息" Then 
Command1.Caption = "保存" 
For i = 0 To 4 
'解除文本框锁定 
Text1(i).Locked = False 
Next i 
Text1(1).Enabled = False 
Text1(0).SetFocus 
Check1.Enabled = True 
Else 
'保存个人信息过程 
Check1.Enabled = False 
On Error GoTo err 
Open "data\ksxx.dat" For Random As #1 Len = Len(kaosheng) 
Open "data\ksxx.tmp" For Random As #2 Len = Len(kaosheng) 
For i = 1 To LOF(1) \ Len(kaosheng) 
Get #1, i, kaosheng 
    If kaosheng.xuehao = Text1(1).text Then 
    kaosheng.xingming = Text1(0).text 
    kaosheng.xuehao = Text1(1).text 
    kaosheng.zhunkaozheng = Text1(2).text 
    kaosheng.age = Text1(4).text 
    kaosheng.sex = Text1(3).text 
    kaosheng.score = Text1(5).text 
 
         '检查是否已修改密码和是否修改符合要求 
         If Check1.Value = 1 And Text2.text = "" And Text3.text = "" Then 
         MsgBox "新密码不能为空", vbInformation, "实验考试系统" 
         Close #1, #2 
         Kill "data\ksxx.tmp" 
         Text2.Enabled = False 
         Text3.Enabled = False 
         Exit Sub 
         ElseIf Check1.Value = 1 And Text2.text <> Text3.text Then 
         MsgBox "两次密码不一致", vbInformation, "  " 
         Close #1, #2 
         Kill "data\ksxx.tmp" 
         Text2.Enabled = False 
         Text3.Enabled = False 
         Exit Sub 
         ElseIf Check1.Value = 1 And Text2.text = Text3.text Then 
         kaosheng.password = Text2.text 
         Else 
         kaosheng.password = Text1(1).text 
         End If 
    Put #2, , kaosheng 
    Else 
    Put #2, , kaosheng 
    End If 
Next i 
Close #1, #2 
Kill "data\ksxx.dat" 
Name "data\ksxx.tmp" As "data\ksxx.dat" 
MsgBox "修改成功", vbInformation, "  " 
err: If err.Number = 70 Then MsgBox "拒绝的权限,请确认磁盘没有被写保护!" 
'恢复文本框锁定状态 
For i = 0 To 5 
Text1(i).Locked = True 
Next i 
 
Text2.Enabled = False 
Text3.Enabled = False 
Command1.Caption = "修改个人信息" 
End If 
End Sub 
 
Private Sub Command2_Click() 
'退出程序 
Unload Me 
End Sub 
'传递姓名和学号 
Private Sub Command3_Click() 
Load Form3 
Form3.show 
Form3.Label1.Caption = "姓名:" + Text1(0).text 
Form3.Label2.Caption = "学号:" + Text1(1).text 
Unload Me 
End Sub 
 
Private Sub exit_Click() 
'退出 
Call Command2_Click 
End Sub 
'加载窗体2后,锁定各个文本框 
Private Sub Form_Load() 
Text2.Enabled = False 
Text3.Enabled = False 
For i = 0 To 5 
Text1(i).Locked = True 
Next i 
Check1.Enabled = False 
End Sub 
 
Private Sub help_Click() 
MsgBox "无可用帮助,请见使用说明!", vbOKOnly, "实验考试系统" 
End Sub 
 
 
Private Sub html_Click() 
'打开网页说明 
Call shoum1 
End Sub 
 
'查看本窗体源代码 
Private Sub local_Click() 
Form7.show 
Form7.Label2.Caption = "data\form2.dat" 
Call dudaima 
End Sub 
'显示系统时间 
Private Sub time_Click() 
Label10.Visible = True 
End Sub 
 
Private Sub Timer1_Timer() 
'同上 
Label10.Caption = Now() 
r = Int(Rnd * 255) + 0 
g = Int(Rnd * 255) + 0 
B = Int(Rnd * 255) + 0 
Label9.ForeColor = RGB(r, g, B) 
End Sub 
 
Private Sub Timer2_Timer() 
'移动字幕提示信息 
Label9.Left = Label9.Left - 100 
If Label9.Left < -6240 Then Label9.Left = 5280 
End Sub 
 
Private Sub txt_Click() 
'打开文本说明 
Call shuom 
End Sub 
 
Private Sub unlogin_Click() 
'注销登录,返回登录窗口 
Load Form1 
Form1.show 
Unload Me 
End Sub