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

📄 frmpcl.frm

📁 学生管理系统,用VB开发的,若需要可提供相关论文
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Height          =   255
      Index           =   0
      Left            =   480
      TabIndex        =   16
      Top             =   480
      Width           =   975
   End
End
Attribute VB_Name = "frmpcl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim selen As New ADODB.Recordset
Dim selex As New ADODB.Recordset
Dim op As Boolean
Dim Error As Boolean





Public Sub displaypcl()

If pclc.RecordCount > 0 Then
For i = 0 To 17
Text1(i).Text = pclc.Fields(i)
Next i

If Text1(17).Text <> "" Then
        Picture1.Picture = LoadPicture(Text1(17).Text)

    
        
  End If
Else
MsgBox "data error!"

End If

End Sub
Private Sub Combo1_Click()
Text1(3).Text = Combo1.Text
End Sub





Private Sub Combo2_Click()
Text1(4).Text = Combo2.Text
End Sub



Private Sub Combo3_Click()
Text1(7).Text = Combo3.Text

End Sub



Private Sub Combo4_Click()
Text1(5).Text = Combo4.Text

End Sub

Private Sub Command1_Click()
Command1.Enabled = False
Command3.Enabled = False
Command2.Enabled = True
Command4.Enabled = True
If pclc.RecordCount > 0 Then
 pclc.MoveFirst
 displaypcl
 
 
Else
  MsgBox "database error!"
 End If
 
End Sub

Private Sub Command10_Click()
If judge = True Then
  If pclc.RecordCount > 0 Then
        pclc.MoveFirst
        displaypcl
Command9.Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
   Else
    MsgBox "database error!"
  End If
Else
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command9.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
Text1(0).Enabled = True
End If

If Error = True Then    'error

  If pclc.RecordCount > 0 Then
 pclc.MoveFirst
 displaypcl
 
   
  Else
    MsgBox "database error!"
 End If
'使功能键有效
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Text2.Text = ""
Text3.Text = ""

End If
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Command10.Enabled = False


End Sub

Private Sub Command11_Click()
Unload Me
frmmain.Visible = True

End Sub

Private Sub Command2_Click()
Command1.Enabled = True
Command3.Enabled = True
If pclc.RecordCount > 0 Then
        pclc.MoveNext
    If Not pclc.EOF Then
        displaypcl
    Else
        Command4.Enabled = False
        Command2.Enabled = False
        pclc.MovePrevious
        displaypcl
    
    End If
   
Else
   MsgBox "database error!"

End If


End Sub

Private Sub Command3_Click()
Command4.Enabled = True
Command2.Enabled = True
If pclc.RecordCount > 0 Then
    pclc.MovePrevious
  If Not pclc.BOF Then
    
    displaypcl
    
  Else
  Command1.Enabled = False
  Command3.Enabled = False
    pclc.MoveNext
    displaypcl
    
   
   End If
 Else
   MsgBox "database error!"
   
End If

End Sub

Private Sub Command4_Click()
Command1.Enabled = True
 Command2.Enabled = False
  Command3.Enabled = True
  Command4.Enabled = False
If pclc.RecordCount > 0 Then
  pclc.MoveLast
  displaypcl
 
  
Else
   MsgBox "databox error!"

End If



End Sub

Private Sub Command5_Click()
Combo1.Enabled = True
Combo2.Enabled = True
Combo3.Enabled = True
Combo4.Enabled = True
judge = True
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command6.Enabled = False
Command7.Enabled = False

Command9.Enabled = True
Command10.Enabled = True

For i = 0 To 17
Text1(i).Text = ""
Next i
Picture1.Picture = LoadPicture("")
Text1(0).SetFocus
Command5.Enabled = False

End Sub

Private Sub Command6_Click()
Dim bresult As Integer
If pclc.RecordCount > 0 Then
 
    bresult = MsgBox("你确实要删除吗?", vbOKCancel)
  If bresult = vbCancel Then
   Exit Sub
   
  Else
    pclc.Delete adAffectCurrent
    pclc.Update
    pclc.Requery
    displaypcl
    
 
 End If

Else
  MsgBox "The Database is Empty!"
  
End If






End Sub


Private Sub Command7_Click()
Text1(0).Enabled = False
judge = False

Combo3.Enabled = True
Combo4.Enabled = True
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command9.Enabled = True
Command10.Enabled = True
Text1(1).SetFocus
SendKeys "{home}+{end}"

End Sub

Private Sub Command8_Click()

If op = True Then
selen.Open "select * from pcl  where a1='" + Text2.Text + "'", cn, adOpenStatic, adLockOptimistic

 ' On Error GoTo error1
 If selen.RecordCount > 0 Then
 
    For i = 0 To 17
       Text1(i).Text = selen.Fields(i)
    Next i
    Picture1.Picture = LoadPicture(Text1(17).Text)
    selen.Close
    Command10.Enabled = False
  Else
    MsgBox "没有你查询的编号或姓名!" + Chr(13) + Chr(10) + Chr(13) + "        请准确输入!"
    selen.Close
    Error = True
   End If
   

Else
  selex.Open "select * from pcl where a2='" + Text3.Text + "'", cn, adOpenStatic, adLockOptimistic
 If selex.RecordCount > 0 Then
     For i = 0 To 17
        Text1(i).Text = selex.Fields(i)
      Next i
    
     Picture1.Picture = LoadPicture(Text1(17).Text)
     selex.Close
     Command10.Enabled = False
 Else
 MsgBox "没有你查询的编号或姓名!" + Chr(13) + Chr(10) + Chr(13) + "        请准确输入!"

  selex.Close
  Error = True
 End If
 

    
End If

'使功能键有效
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Text2.Text = ""
Text3.Text = ""

    

 
End Sub

Private Sub Command9_Click()




If judge = True Then 'add


    For i = 0 To 16
       aa = aa + "'" + Trim(frmpcl.Text1(i).Text) + "'" + ","
   
    Next i
    
     
   aa = aa + "'" + Trim(frmpcl.Text1(17).Text) + "'"
   
 
 On Error GoTo b
 cn.Execute "insert into pcl values(" + aa + ")"
 
 pclc.Update
 pclc.Requery
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command10.Enabled = False
Command9.Enabled = False

 If 0 > 1 Then
b:
  MsgBox "操作错误" + Chr(13) + Chr(10) + "不能添加重复的编号" + Chr(13) + Chr(10) + "请按'取消'键,重新添加!"
 End If
 
 
 
 
Else 'modify
Text1(0).Enabled = True
     pclc.Update
     
  With pclc
  
  For i = 0 To 17
   .Fields(i) = Text1(i).Text
  Next i
  
 End With
 pclc.Update
 'pclc.Requery
 'displaypcl
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Command4.Enabled = True
Command5.Enabled = True
Command6.Enabled = True
Command7.Enabled = True
Command9.Enabled = False
Command10.Enabled = False
 
 
End If
Command9.Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Combo4.Text = ""
End Sub

Private Sub Form_Load()
Command9.Enabled = False
Command8.Enabled = False
Command10.Enabled = False
Set pclc = New ADODB.Recordset
pclc.Open "select * from pcl", cn, adOpenStatic, adLockOptimistic

If pclc.RecordCount > 0 Then

 pclc.MoveFirst     '首先移到第一条记录
 displaypcl


 Else
    MsgBox "database error!"
    
End If
Combo1.AddItem "男" 'combo1
Combo1.AddItem "女"
Combo1.Enabled = False


Combo2.AddItem "汉" 'combo2
Combo2.AddItem "满"
Combo2.AddItem "回"
Combo2.AddItem "朝鲜"
Combo2.AddItem "藏"
Combo2.AddItem "彝"
Combo2.AddItem "蒙古"
Combo2.AddItem "壮"
Combo2.AddItem "苗"
Combo2.Enabled = False

Combo3.AddItem "未婚" 'combo3
Combo3.AddItem "已婚"
Combo3.AddItem "丧偶"
Combo3.Enabled = False


Combo4.AddItem "团员" 'combo4
Combo4.AddItem "党员"
Combo4.AddItem "无党派"
Combo4.Enabled = False



End Sub



Private Sub Text1_GotFocus(Index As Integer)
If Index = 17 Then
   cd1.ShowOpen
If cd1.FileName <> "" Then
  Text1(17).Text = cd1.FileName
  Picture1.Picture = LoadPicture(cd1.FileName)
  

End If
End If


End Sub

Private Sub Text2_Change()
If Text2.Text <> "" Then     ' text2
 op = True
For i = 0 To 17
Text1(i).Text = ""
Next i
Picture1.Picture = LoadPicture("")
'使功能键无效
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command10.Enabled = True
Else
 Command8.Enabled = False

End If

End Sub

Private Sub Text3_Change()

If Text3.Text = "" Then     ' text3
 Command8.Enabled = False
Else
op = False
For i = 0 To 17
Text1(i).Text = ""
Next i
Picture1.Picture = LoadPicture("")
'使功能键无效
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = True
Command10.Enabled = True
 
End If

End Sub

⌨️ 快捷键说明

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