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

📄 frm_setfee.frm

📁 学生信息的管理是学校经常遇到的问题。学生数量的积聚增加和学生认识制度的改革
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Height          =   450
      Left            =   0
      Picture         =   "frm_setfee.frx":FB64
      Top             =   0
      Width           =   450
   End
   Begin VB.Image imgrighttitle 
      Height          =   525
      Left            =   5940
      Picture         =   "frm_setfee.frx":1066E
      Top             =   0
      Width           =   375
   End
   Begin VB.Image imgtop 
      Height          =   450
      Left            =   270
      Picture         =   "frm_setfee.frx":11114
      Stretch         =   -1  'True
      Top             =   0
      Width           =   5760
   End
End
Attribute VB_Name = "frm_setfee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim myfee As Cls_Fee
Private Sub Command1_GotFocus(Index As Integer)
Select Case Index
Case 0
   If Text1(2) = "" And (command1(0).Caption = "提交" Or command1(1).Caption = "更新") Then Text1(2).SetFocus
Case 1
   If Text1(2) = "" And (command1(0).Caption = "提交" Or command1(1).Caption = "更新") Then Text1(2).SetFocus
End Select
End Sub

Private Sub Form_Load()
SetWindow Me
    AlwaysOnTop Me, False
    Set myfee = New Cls_Fee
    
    Move (frm_main.Width - Me.Width) / 2, (frm_main.Height - Me.Height) / 2 - 800
    '显示学费编号于list1中
    myfee.OpenFee
    If myfee.GetFeeRs.EOF = False Then
       Do Until myfee.GetFeeRs.EOF
          List1.AddItem myfee.GetFeeRs.Fields(0)
          myfee.GetFeeRs.MoveNext
       Loop
    End If
    State "cencel"
End Sub

Private Sub List1_Click()
Dim i As Integer
'按选中的学费编号将详细信息显示在文本框中
State "selected"
  myfee.QueryFeeByID Trim(List1.Text)
  If myfee.GetQryFeeByIdRs.EOF = False Then
     DisplayOut myfee.GetQryFeeByIdRs
  End If
  For i = 0 To List1.ListCount - 1
      List1.Selected(i) = False
  Next

End Sub


Private Sub command1_Click(Index As Integer)
Select Case Index
'增加
Case 0
    If command1(0).Caption = "增加" Then
       State "add"
    Else
        If Text1(0) <> "" And Text1(1) <> "" And Text1(2) <> "" Then
           myfee.QueryFeeByID Trim(Text1(0))
           If myfee.GetQryFeeByIdRs.EOF Then
                frm_ProgressBar.Show 1
                myfee.OpenFee
                myfee.GetFeeRs.AddNew
                DisplayIn myfee.GetFeeRs
                myfee.GetFeeRs.Update
                myfee.GetFeeRs.Requery
                RefreshList
                State "cencel"
           Else
             MsgBox "该价格项已存在,请重新输入!"
             Exit Sub
           End If
        Else
          MsgBox "请先输入数据!"
          Text1(0).SetFocus
        End If
    End If
'修改
Case 1
    If command1(1).Caption = "修改" Then
       State "edit"
    Else
       frm_ProgressBar.Show 1
       myfee.QueryFeeByID Trim(Text1(0))
       DisplayIn myfee.GetQryFeeByIdRs
       myfee.GetQryFeeByIdRs.Update
       myfee.GetQryFeeByIdRs.Requery
       State "cencel"
    End If
'删除
Case 2
    Dim yn As String
    yn = MsgBox("真的删除吗?", vbYesNo, "删除")
    If yn = vbYes Then
      frm_ProgressBar.Show 1
      myfee.QueryFeeByID Trim(Text1(0))
      myfee.GetQryFeeByIdRs.Delete
      myfee.GetQryFeeByIdRs.Requery
      RefreshList
      State "delete"
    Else
      State "cencel"
    End If
    
       
'取消
Case 3
       State "cencel"
       
'退出
Case 4
       Unload Me
End Select
End Sub

Public Sub State(kind As String)
'各种操作时各个控件的状态
Dim i As Integer
Select Case kind
Case "add"
 For i = 0 To 2
     Text1(i) = ""
     Text1(i).Enabled = True
 Next
    Text1(0).SetFocus
    command1(0).Caption = "提交"
    command1(0).DragMode = 0
    command1(1).DragMode = 1
    command1(2).DragMode = 1
    command1(3).DragMode = 0
    command1(4).DragMode = 1
    
Case "edit"
 For i = 1 To 2
     Text1(i).Enabled = True
 Next
 Text1(1).SetFocus
 command1(1).Caption = "更新"
 command1(0).DragMode = 1
 command1(1).DragMode = 0
 command1(2).DragMode = 1
 command1(3).DragMode = 0
 command1(4).DragMode = 1
 
Case "cencel"
 For i = 0 To 2
     Text1(i) = ""
     Text1(i).Enabled = False
 Next
 
 command1(0).Caption = "增加"
 command1(1).Caption = "修改"
 command1(0).DragMode = 0
 command1(1).DragMode = 1
 command1(2).DragMode = 1
 command1(3).DragMode = 1
 command1(4).DragMode = 0
 
Case "delete"
 For i = 0 To 2
     Text1(i) = ""
     Text1(i).Enabled = False
 Next
 
 command1(0).Caption = "增加"
 command1(1).Caption = "修改"
 command1(0).DragMode = 0
 command1(1).DragMode = 1
 command1(2).DragMode = 1
 command1(3).DragMode = 1
 command1(4).DragMode = 0

Case "selected"
 For i = 0 To 2
     Text1(i).Enabled = False
 Next
 
 command1(0).Caption = "增加"
 command1(1).Caption = "修改"
 command1(0).DragMode = 0
 command1(1).DragMode = 0
 command1(2).DragMode = 0
 command1(3).DragMode = 1
 command1(4).DragMode = 0
End Select
End Sub


Private Sub Text1_GotFocus(Index As Integer)
'设定文本框获得焦点时处于全部被选中状态
Text1(Index).SelLength = Len(Text1(Index).Text)
Select Case Index
Case 1
   If Text1(0) = "" Then Text1(0).SetFocus
Case 2
   If Text1(1) = "" Then Text1(1).SetFocus
End Select
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
'传递焦点
Select Case Index
Case 0
    If KeyAscii = 13 Then Text1(1).SetFocus
Case 1
    If KeyAscii = 13 Then Text1(2).SetFocus
Case 2
    If KeyAscii = 13 And command1(0).DragMode = 0 Then
       command1(0).SetFocus
    ElseIf KeyAscii = 13 And command1(0).DragMode = 1 Then
       command1(1).SetFocus
    End If
End Select
End Sub

Public Function DisplayIn(myrs As Recordset)
Dim i As Integer
For i = 0 To 2
    myrs.Fields(i) = Trim(Text1(i))
Next
End Function
Public Function DisplayOut(myrs As Recordset)
Dim i As Integer
For i = 0 To 2
    Text1(i) = myrs.Fields(i)
Next
End Function

Public Sub RefreshList()
    List1.Clear
    myfee.OpenFee
    If myfee.GetFeeRs.EOF = False Then
       Do Until myfee.GetFeeRs.EOF
          List1.AddItem myfee.GetFeeRs.Fields(0)
          myfee.GetFeeRs.MoveNext
       Loop
    End If
    State "cencel"
End Sub
Private Sub imgclose_Click()
    Unload Me
End Sub


Private Sub imglefttitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DrawForms Me
End Sub

Private Sub imgtop_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    DrawForms Me
End Sub


Private Sub imgrighttitle_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
   DrawForms Me
End Sub

⌨️ 快捷键说明

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