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

📄 frmleixing.frm

📁 vb精彩编程希望大家有用
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmleixing 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "考试类型设置"
   ClientHeight    =   4845
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   4290
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4845
   ScaleWidth      =   4290
   Begin VB.Frame Frame1 
      Caption         =   "考试类型设置"
      Height          =   4815
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4215
      Begin VB.ListBox List1 
         BackColor       =   &H80000018&
         Height          =   3480
         Left            =   120
         TabIndex        =   10
         Top             =   240
         Width           =   2175
      End
      Begin VB.Frame Frame2 
         Caption         =   "类型:"
         Height          =   735
         Left            =   120
         TabIndex        =   8
         Top             =   3900
         Width           =   2175
         Begin VB.TextBox Text1 
            BackColor       =   &H80000018&
            Enabled         =   0   'False
            Height          =   375
            Left            =   120
            TabIndex        =   9
            Top             =   240
            Width           =   1935
         End
      End
      Begin VB.Frame Frame3 
         Caption         =   "提示"
         Height          =   2295
         Left            =   2520
         TabIndex        =   5
         Top             =   1680
         Width           =   1455
         Begin VB.Label Label1 
            Alignment       =   2  'Center
            Caption         =   "    在新增资料对话框中输入新的考试类型条目,按回车即可完成添加资料。"
            Height          =   1020
            Left            =   120
            TabIndex        =   7
            Top             =   240
            Width           =   1305
         End
         Begin VB.Label Label2 
            Caption         =   "    选中列表框中条目点击删除钮即可删除选中条目。  "
            Height          =   735
            Left            =   120
            TabIndex        =   6
            Top             =   1320
            Width           =   1215
         End
      End
      Begin VB.CommandButton Command1 
         Caption         =   "退出"
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   4200
         Width           =   975
      End
      Begin VB.CommandButton Command2 
         Caption         =   "增加"
         Height          =   375
         Left            =   2640
         TabIndex        =   3
         Top             =   720
         Width           =   1095
      End
      Begin VB.CommandButton Command3 
         Caption         =   "删除"
         Height          =   375
         Left            =   2640
         TabIndex        =   2
         Top             =   1200
         Width           =   1095
      End
      Begin VB.CommandButton Command4 
         Caption         =   "修改"
         Height          =   375
         Left            =   2640
         TabIndex        =   1
         Top             =   240
         Width           =   1095
      End
      Begin MSAdodcLib.Adodc Adodc1 
         Height          =   375
         Left            =   2160
         Top             =   3960
         Visible         =   0   'False
         Width           =   1200
         _ExtentX        =   2117
         _ExtentY        =   661
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "Adodc1"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
   End
End
Attribute VB_Name = "Frmleixing"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'考试类型设置
Private Sub Command1_Click()
    Unload Me
End Sub
Private Sub Command2_Click()
    If Command2.Caption = "确定" Then
        If Text1.Text = "" Then
            sssss = MsgBox("类型名称不能为空!", vbOKOnly + vbExclamation, "警告")
            Text1.SetFocus
            Exit Sub
        End If
        qxstr = Executeqx(4)
        If qxstr = "readonly" Then
            ss = MsgBox("对不起,你是只读用户不能添加记录,请与管理员联系!", _
                vbInformation + vbOKOnly, " 警告")
            Exit Sub
        End If
        Adodc1.RecordSource = "select * from kaoshileixing where 类型='" & _
            Trim(Text1.Text) & "'"
        Adodc1.Refresh
        If Adodc1.Recordset.EOF = False Then
            sssss = MsgBox("已经存在该类型名称!", vbOKOnly + vbExclamation, "警告")
            Text1.SetFocus
            Text1.SelStart = 0
            Text1.SelLength = Len(Text1.Text)
            Exit Sub
        Else
            Adodc1.Recordset.AddNew
            Adodc1.Recordset.Fields(0) = Text1.Text
            Adodc1.Recordset.Update
            Command2.Caption = "增加"
            Command3.Enabled = True
            Command4.Enabled = True
            Text1.Text = ""
            Text1.Enabled = False
            leixingfilldata
        End If
    Else
        Text1.Enabled = True
        Text1.Text = ""
        Text1.SetFocus
        Command2.Caption = "确定"
        Command3.Enabled = False
        Command4.Enabled = False
    End If
End Sub
Private Sub Command3_Click()
    qxstr = Executeqx(4)
    If qxstr = "readonly" Then
        ss = MsgBox("对不起,你是只读用户不能添加记录,请与管理员联系!", _
            vbInformation + vbOKOnly, " 警告")
        Exit Sub
    End If
    If Trim(Text1.Text) = "" Then
        sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
    Else
        If MsgBox("确定要删除 类型名称 为 " & Trim(List1.List(List1.ListIndex)) & _
            " 的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
            Adodc1.RecordSource = "select * from kaoshileixing where 类型='" & _
                Trim(List1.List(List1.ListIndex)) & "'"
            Adodc1.Refresh
            Adodc1.Recordset.Delete
            Text1.Text = ""
            leixingfilldata
        End If
    End If
End Sub
Private Sub Command4_Click()
    If Text1.Text = "" Then
        sssss = MsgBox("你还没有选择记录!", vbOKOnly + vbExclamation, "警告")
        Exit Sub
    End If
    If Command4.Caption = "确定" Then
        If Text1.Text = "" Then
            sssss = MsgBox("课程名称不能为空!", vbOKOnly + vbExclamation, "警告")
            Text1.SetFocus
            Exit Sub
        End If
        qxstr = Executeqx(4)
        If qxstr = "readonly" Then
            ss = MsgBox("对不起,你是只读用户不能修改记录,请与管理员联系!", _
                vbInformation + vbOKOnly, " 警告")
            Exit Sub
        End If
        Adodc1.RecordSource = "select * from kaoshileixing where 类型='" & _
            Trim(List1.List(List1.ListIndex)) & "'"
        Adodc1.Refresh
        Adodc1.Recordset.Fields(0) = Text1.Text
        Adodc1.Recordset.Update
        Text1.Text = ""
        leixingfilldata
        Command4.Caption = "修改"
        Command2.Enabled = True
        Command3.Enabled = True
        Text1.Enabled = False
    Else
        Text1.Enabled = True
        Text1.SetFocus
        Command4.Caption = "确定"
        Command2.Enabled = False
        Command3.Enabled = False
    End If
End Sub
Private Sub Form_Load()
    Adodc1.ConnectionString = connstring
    leixingfilldata
End Sub
Private Sub leixingfilldata()
    Dim j As Integer
    Dim i As Integer
    List1.Clear
    Dim mrc As ADODB.Recordset
    Adodc1.RecordSource = "select * from kaoshileixing order by 类型"
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = False Then
        Adodc1.Recordset.MoveFirst
        Do While Not Adodc1.Recordset.EOF
            List1.AddItem Adodc1.Recordset.Fields(0)
            Adodc1.Recordset.MoveNext
        Loop
    End If
End Sub
Private Sub List1_Click()
    Text1.Text = List1.List(List1.ListIndex)
End Sub

⌨️ 快捷键说明

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