form15.frm

来自「主要用于学校机房考试,主要包括选择题,问答题,WORD操作题,WINDOWS操作」· FRM 代码 · 共 204 行

FRM
204
字号
VERSION 5.00
Begin VB.Form Form15 
   Caption         =   "Form15"
   ClientHeight    =   3675
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6420
   LinkTopic       =   "Form15"
   ScaleHeight     =   3675
   ScaleWidth      =   6420
   StartUpPosition =   3  '窗口缺省
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   ""
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   5400
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   ""
      Top             =   3360
      Width           =   1140
   End
   Begin VB.CommandButton Command1 
      Caption         =   ">"
      Height          =   495
      Left            =   2400
      TabIndex        =   7
      Top             =   360
      Width           =   495
   End
   Begin VB.CommandButton Command2 
      Caption         =   ">>"
      Height          =   495
      Left            =   2400
      TabIndex        =   6
      Top             =   1080
      Width           =   495
   End
   Begin VB.CommandButton Command3 
      Caption         =   "<"
      Height          =   495
      Left            =   2400
      TabIndex        =   5
      Top             =   1800
      Width           =   495
   End
   Begin VB.CommandButton Command4 
      Caption         =   "<<"
      Height          =   495
      Left            =   2400
      TabIndex        =   4
      Top             =   2400
      Width           =   495
   End
   Begin VB.CommandButton Command5 
      Caption         =   "确定"
      Height          =   495
      Left            =   5400
      TabIndex        =   3
      Top             =   360
      Width           =   975
   End
   Begin VB.CommandButton Command6 
      Caption         =   "取消"
      Height          =   495
      Left            =   5400
      TabIndex        =   2
      Top             =   960
      Width           =   975
   End
   Begin VB.ListBox List1 
      Height          =   3300
      Left            =   0
      TabIndex        =   1
      Top             =   240
      Width           =   2175
   End
   Begin VB.ListBox List2 
      Height          =   3300
      Left            =   3120
      TabIndex        =   0
      Top             =   240
      Width           =   2055
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "可见列:"
      Height          =   180
      Left            =   3120
      TabIndex        =   9
      Top             =   0
      Width           =   720
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "不可见列:"
      Height          =   180
      Left            =   120
      TabIndex        =   8
      Top             =   0
      Width           =   900
   End
End
Attribute VB_Name = "Form15"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
For i = 0 To List1.ListCount - 1 Step 1
If List1.Selected(i) Then
List2.AddItem List1.Text
List1.RemoveItem (List1.ListIndex)
Exit Sub
End If
Next

End Sub

Private Sub Command2_Click()
For i = 0 To List1.ListCount - 1 Step 1
List2.AddItem List1.List(i)
Next
List1.Clear
End Sub

Private Sub Command3_Click()
On Error Resume Next
For i = 0 To List2.ListCount - 1 Step 1
If List2.Selected(i) Then
List1.AddItem List2.Text
List2.RemoveItem (List2.ListIndex)
Exit Sub
End If
Next
End Sub

Private Sub Command4_Click()
For i = 0 To List2.ListCount - 1 Step 1
List1.AddItem List2.List(i)
Next
List2.Clear
End Sub

Private Sub Command5_Click()
Dim ListStr As String
Form17.Data1.Refresh
If List2.ListCount <> 0 Then
    For i = 0 To List2.ListCount - 1 Step 1
        If (i <> List2.ListCount - 1) Then
            Form17.Label1.caption = List2.List(0)
            Form17.Label2.caption = List2.List(1)
            Form17.Label3.caption = List2.List(2)
            Form17.Label4.caption = List2.List(3)
            Form17.Text1.DataField = List2.List(0)
            Form17.Text2.DataField = List2.List(1)
            Form17.Text3.DataField = List2.List(2)
            Form17.Text4.DataField = List2.List(3)
            ListStr = ListStr + List2.List(i) + ","
        Else
            ListStr = ListStr + List2.List(i)
          
        End If
    Next
End If
            If ListStr = "" Then
               Form17.Data1.RecordSource = "学生情况表 "
            Else
             Form17.Data1.RecordSource = "select " + ListStr + ",毕业学校 from 学生情况表 where 毕业学校= " & "'" & Trim(Form17.DBCombo1.Text) & "'"
                Form17.Data1.Refresh

            End If
Me.Hide
Form17.Show
End Sub

Private Sub Command6_Click()
Data1.RecordSource = "select * from 学生情况表"
'Form14.Data1.Refresh
Me.Hide
Form17.Show
End Sub

Private Sub Form_Initialize()
For i = 0 To Data1.Recordset.Fields.Count - 1 Step 1
List1.AddItem Data1.Recordset.Fields(i).Name
Next
End Sub

Private Sub Form_Load()
'Data1.DatabaseName = App.Path + "\" + "teacher.mdb"
'Data1.RecordSource = "学生情况表"
'Data1.Refresh
End Sub

⌨️ 快捷键说明

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