📄 frmxuanze.frm
字号:
recordnum1 = recordc1
adodc1.Recordset.AddNew
End If
Dim lsneirong As String
Dim textnum, k, g As Integer
lsneirong = Text3.Text
textnum = 0
Text1.Text = ""
Text8.Text = ""
For k = 1 To Len(lsneirong)
If Asc(Mid(lsneirong, k, 1)) < 0 Then
textnum = textnum + 2
Else
textnum = textnum + 1
End If
If textnum >= 195 And k < Len(lsneirong) Then
If Combo1.ListIndex <= 1 Then
MsgBox "你输入的内容太长,无法完全存放入数据库中。" + Chr(13) + "多余的部分将被截去。", vbInformation, App.EXEName
End If
Exit For
End If
Next k
If k >= Len(lsneirong) Then
Text1.Text = lsneirong
Else
Text1.Text = Mid(lsneirong, 1, k)
If Combo1.ListIndex > 1 Then
lsneirong = Mid(lsneirong, k + 1, Len(lsneirong) - k)
textnum = 0
For g = 1 To Len(lsneirong)
If Asc(Mid(lsneirong, g, 1)) < 0 Then
textnum = textnum + 2
Else
textnum = textnum + 1
End If
If textnum >= 195 And g < Len(lsneirong) Then
MsgBox "你输入的内容太长,无法完全存放入数据库中。" + Chr(13) + "多余的部分将被截去。", vbInformation, App.EXEName
Exit For
End If
Next g
If g >= Len(lsneirong) Then
Text8.Text = lsneirong
Else
Text8.Text = Mid(lsneirong, 1, g)
End If
Else
Text8.Text = ""
End If
End If
Text4.Text = Combo3.Text
For i = 0 To 3
Text2(i).Text = Text7(i).Text
Next i
Text1.SetFocus
Text2(0).SetFocus
adodc1.Recordset.MovePrevious
adodc1.Recordset.MoveNext
huifu
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 浏览状态"
fMainForm.sbStatusBar.Panels(1).Text = stats
End Sub
Private Sub Command5_Click()
Command6.Default = True
Text3.Text = Text1.Text
Combo3.Text = Text4.Text
For i = 0 To 3
Text7(i).Text = Text2(i).Text
Next i
huifu
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 浏览状态"
fMainForm.sbStatusBar.Panels(1).Text = stats
End Sub
Public Sub Command6_Click()
Command6.Default = False
Text3.Text = ""
For i = 0 To 3
Text7(i).Text = ""
Next i
stats = "当前记录:EOF/EOF (插入状态)"
fMainForm.sbStatusBar.Panels(1).Text = stats
huifu
presskey = "添加"
Text3.SetFocus
End Sub
Public Sub Command7_Click()
If adodc1.Recordset.RecordCount <> 0 Then
Command6.Default = False
presskey = "修改"
huifu
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 修改状态"
fMainForm.sbStatusBar.Panels(1).Text = stats
Text3.SetFocus
End If
End Sub
Public Sub Command8_Click()
If recordc1 >= 1 Then
presskey = "删除"
tuichu = MsgBox("确定此题吗?", vbYesNo + vbQuestion, "确认?")
If tuichu = 6 Then
adodc1.Recordset.Delete
recordc1 = recordc1 - 1
If recordc1 < recordnum1 Then
recordnum1 = recordnum1 - 1
End If
End If
If recordnum1 = 0 Then
stats = "当前记录:BOF/EOF"
Else
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 浏览状态"
End If
fMainForm.sbStatusBar.Panels(1).Text = stats
End If
End Sub
Private Sub Command9_Click()
If recordnum1 = 1 Then
MsgBox "己到记录首", vbInformation, "查询"
Else
For i = recordnum1 - 1 To 1 Step -1
Command12_Click
lookfor
If find1 And find2 Then
Exit Sub
End If
If i = 1 Then
MsgBox "没有找到符合条件的记录!", vbInformation, "无此记录"
End If
Next i
End If
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
If LastRow <> "" And Text1.Text <> "" Then
recordnum1 = DataGrid1.GetBookmark(0)
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 浏览状态"
fMainForm.sbStatusBar.Panels(1).Text = stats
End If
End Sub
Private Sub Form_Activate()
Me.top = 0
Me.left = 0
Me.Height = 7000
Me.Width = 11720
recordc1 = adodc1.Recordset.RecordCount
If recordc1 >= 1 Then
recordnum1 = 1
adodc1.Recordset.Move (0)
Else
recordnum1 = 0
End If
stats = "当前记录:" + Str(recordnum1) + "/" + Str(recordc1) + " 浏览状态"
fMainForm.sbStatusBar.Panels(1).Text = stats
End Sub
Private Sub Form_Deactivate()
If Command5.Enabled Then
Command5_Click
End If
Unload Me
End Sub
Private Sub Form_Load()
adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\kaoti.mdb;Persist Security Info=False"
adodc1.RecordSource = "xuanze1"
adodc1.Refresh
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\SHIJUAN.mdb;Persist Security Info=True"
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\SHIJUAN.MDB;Persist Security Info=False"
Adodc3.RecordSource = "yxuanze1"
Adodc3.Refresh
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\kaoti.mdb;Persist Security Info=False"
Combo1.ListIndex = 0
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Command5.Enabled Then
Command5_Click
End If
End Sub
Private Sub Frame3_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Label1.ForeColor = &H0&
End Sub
Private Sub Frame3_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = 2 And Command6.Enabled = True Then
If recordc1 = 0 Then
frmmnu.gotond1.Enabled = False
frmmnu.gotond2.Enabled = False
Else
If Combo1.Text = "" Or Combo1.Text = "1" Or Combo1.Text = "3" Then
frmmnu.gotond1.Enabled = False
frmmnu.gotond2.Enabled = True
Else
frmmnu.gotond1.Enabled = True
frmmnu.gotond2.Enabled = False
End If
End If
PopupMenu frmmnu.popmnu
End If
End Sub
Public Sub Label1_Click()
If recordc1 <> 0 Then
Dim dfile, inputTip, inputs, ls As String
Dim InFile As Integer
InFile = FreeFile
dfile = App.Path & "\data\tipofday.txt"
If Dir(dfile) = "" Then
Open dfile For Output As InFile
Else
Open dfile For Append As InFile
End If
inputs = ""
For i = 1 To Len(Text3.Text)
ls = Mid(Text3.Text, i, 1)
If Asc(ls) = 13 Then
i = i + 1
inputs = inputs + Chr(10)
Else
inputs = inputs + ls
End If
Next i
For j = 0 To 3
inputs = inputs + Chr(10) + Chr(10) + Chr(65 + j) + ":"
For i = 1 To Len(Text7(j).Text)
ls = Mid(Text7(j).Text, i, 1)
If Asc(ls) = 13 Then
inputs = inputs + Chr(10)
Else
inputs = inputs + ls
End If
Next i
Next j
inputs = inputs + Chr(10) + Chr(10) + "答案:" + Text4.Text
Write #InFile, inputs
Close InFile
MsgBox "已经成功将此题加如每日提示中。", vbInformation, "成功加入"
Else
MsgBox "空记录,无法加入到提示框中去", vbExclamation, App.EXEName
End If
End Sub
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Dim icon As String
Label1.ForeColor = &H8000000E
icon = App.Path & "\ico\hand.cur"
Label1.MouseIcon = LoadPicture(icon)
End Sub
Private Sub Text1_Change()
If presskey <> "添加" Then
Text3.Text = Text1.Text
End If
End Sub
Private Sub huifu()
Combo1.Enabled = Not Combo1.Enabled
Text3.Locked = Not Text3.Locked
For i = 0 To 3
Text7(i).Locked = Not Text7(i).Locked
Next i
Combo3.Locked = Not Combo3.Locked
Text4.Locked = Not Text4.Locked
Command1.Enabled = Not Command1.Enabled
Command2.Enabled = Not Command2.Enabled
Command3.Enabled = Not Command3.Enabled
Command4.Enabled = Not Command4.Enabled
Command5.Enabled = Not Command5.Enabled
Command6.Enabled = Not Command6.Enabled
Command7.Enabled = Not Command7.Enabled
Command8.Enabled = Not Command8.Enabled
Command11.Enabled = Not Command11.Enabled
Command12.Enabled = Not Command12.Enabled
Command13.Enabled = Not Command13.Enabled
Command14.Enabled = Not Command14.Enabled
Command15.Enabled = Not Command15.Enabled
Frame6.Enabled = Not Frame6.Enabled
DataGrid1.Enabled = Not DataGrid1.Enabled
End Sub
Private Sub Text2_Change(Index As Integer)
If presskey <> "添加" Then
Text7(Index).Text = Text2(Index).Text
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 10
End If
End Sub
Private Sub Text4_Change()
If presskey <> "添加" Then
Combo3.Text = Text4.Text
End If
End Sub
Private Sub Text7_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
KeyAscii = 10
End If
End Sub
Private Sub Text8_Change()
If Text8.Text <> "" Then
Text3.Text = Text1.Text + Text8.Text
End If
End Sub
Private Sub lookfor()
find1 = False
find2 = False
If Combo2(0).Text = "=" Then
If Text1.Text = Text5.Text Then
find1 = True
End If
End If
If Combo2(0).Text = "包含" Then
For j = 0 To Len(Text1.Text) - Len(Text5.Text)
If Text5.Text = Mid(Text1.Text, j + 1, Len(Text5.Text)) Then
find1 = True
End If
Next j
End If
If Combo2(0).Text = "忽略" Then
find1 = True
End If
If Combo2(1).Text = "=" Then
For j = 0 To 3
If Text2(j).Text = Text6.Text Then
find2 = True
End If
Next j
End If
If Combo2(1).Text = "包含" Then
For k = 0 To 3
For j = 0 To Len(Text2(k).Text) - Len(Text6.Text)
If Text6.Text = Mid(Text2(k).Text, j + 1, Len(Text6.Text)) Then
find2 = True
End If
Next j
Next k
End If
If Combo2(1).Text = "忽略" Then
find2 = True
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -