?? frmleixing.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frmleixing
BorderStyle = 1 'Fixed Single
Caption = "考試類型設(shè)置"
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 = "考試類型設(shè)置"
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 = 3120
Top = 4680
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("對不起,你是只讀用戶不能添加記錄,請與管理員聯(lián)系!", 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("已經(jīng)存在該類型名稱!", 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("對不起,你是只讀用戶不能添加記錄,請與管理員聯(lián)系!", 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("對不起,你是只讀用戶不能修改記錄,請與管理員聯(lián)系!", 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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -