End If
End If
If Text1.Text <> "" Then
b = Text4.Text
b = b + 1
a = Text1.Text
Open "d:\bjglxt\班级事件\cc.txt" For Random As #2
Open "d:\bjglxt\班级事件\dd.txt" For Random As #1
Put #1, b, a
Put #2, , b
Text4.Text = b
Close
End If
ElseIf y = 1 Then
MsgBox ("请你先清空在写入内容后点添加")
End If
Else
MsgBox "你不是管理员,请先登陆管理员", , "提示"
End If
End Sub
Private Sub Command2_Click()
y = 1
Dim c As Integer
Dim a As String
If o = 1 Then
If CInt(Text3.Text) > CInt(Text4.Text) Or CInt(Text3.Text) = 0 Then
MsgBox ("没有此记录")
ElseIf CInt(Text3.Text) > 0 And CInt(Text3.Text) <= CInt(Text4.Text) Then
c = CInt(Text3.Text)
Open "d:\bjglxt\班级事件\dd.txt" For Random As #1
Get #1, c, a
If a = "" Then
MsgBox ("您当时添加的是一条空记录")
Text1.Text = a
ElseIf a <> "" Then
Text1.Text = a
End If
Close
End If
ElseIf o = 0 Then
MsgBox ("请输入正确的记录号(只限数字且不要超出记录条数)")
End If
Timer1.Enabled = True
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text3.Text = ""
y = 0
End Sub
Private Sub Command4_Click()
End Sub
Private Sub Form_Load()
y = 0
o = 0
Dim c As Integer
Open "d:\bjglxt\班级事件\cc.txt" For Random As #2
Get #2, , c
Text4.Text = c
Close
End Sub
Private Sub Timer1_Timer()
If Text3.Text <> "" Then
o = 1
If Text3.Text >= "a" And Text3.Text <= "z" Then
'Timer1.Enabled = False
MsgBox ("请输入正确的记录号(只限数字)")
Text3.Text = ""
End If
ElseIf Text3.Text = "" Then
o = 0
End If
End Sub
7:管理员界面设计
代码分析:
Private Sub CMD_OK_Click()
On Error GoTo ero
Data1.Refresh
ero:
End Sub
Private Sub CMD_RESET_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.