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

📄 frmeditwords.frm

📁 原代码功能:是一个的单词记学习器,实现单词的浏览,还可以自己添加自己所要学习的单词,用一个对话框进行单词的浏览.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmEditWords 
   Caption         =   "编辑单词"
   ClientHeight    =   5400
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7320
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5400
   ScaleWidth      =   7320
   StartUpPosition =   3  '窗口缺省
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "D:\deskpet\wordreading\wordlib.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   285
      Left            =   2040
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "words"
      Top             =   4320
      Visible         =   0   'False
      Width           =   1140
   End
   Begin VB.Frame Frame2 
      Caption         =   "单词内容"
      Height          =   5055
      Left            =   2160
      TabIndex        =   1
      Top             =   120
      Width           =   5055
      Begin VB.CommandButton cmdDelete 
         Caption         =   "删除"
         Height          =   495
         Left            =   1200
         TabIndex        =   12
         Top             =   4320
         Width           =   975
      End
      Begin VB.CommandButton cmdSubmit 
         Caption         =   "编辑"
         Height          =   495
         Left            =   3240
         TabIndex        =   11
         Top             =   4320
         Width           =   1095
      End
      Begin VB.TextBox txtInterpret 
         Height          =   1815
         Left            =   1200
         ScrollBars      =   2  'Vertical
         TabIndex        =   10
         Top             =   2040
         Width           =   3255
      End
      Begin VB.TextBox txtProperty 
         Height          =   375
         Left            =   1200
         TabIndex        =   8
         Top             =   1200
         Width           =   3255
      End
      Begin VB.TextBox txtSpell 
         Height          =   375
         Left            =   1200
         TabIndex        =   6
         Top             =   360
         Width           =   3255
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "解释"
         Height          =   180
         Left            =   480
         TabIndex        =   9
         Top             =   2760
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "词性"
         Height          =   180
         Left            =   480
         TabIndex        =   7
         Top             =   1320
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "拼写"
         Height          =   180
         Left            =   480
         TabIndex        =   5
         Top             =   480
         Width           =   360
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "选择单词"
      Height          =   5055
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   1815
      Begin VB.ListBox wordList 
         Height          =   3660
         ItemData        =   "frmEditWords.frx":0000
         Left            =   120
         List            =   "frmEditWords.frx":0002
         Sorted          =   -1  'True
         TabIndex        =   4
         Top             =   840
         Width           =   1575
      End
      Begin VB.ComboBox wordselect 
         Height          =   300
         Left            =   1080
         TabIndex        =   3
         Text            =   "A"
         Top             =   360
         Width           =   615
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "首字母"
         Height          =   180
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   540
      End
   End
End
Attribute VB_Name = "frmEditWords"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim id As Integer

Private Sub cmdDelete_Click()

On Error Resume Next
Dim c, deleteID As Integer

c = MsgBox("单词" & Data1.Recordset("spell") & "将删除,确定吗?", 4 + 48, "警告")
 
If c = vbNo Then Exit Sub
deleteID = Data1.Recordset("id")
Data1.Recordset.Delete
Data1.Refresh
Data1.Recordset.Close
txtSpell.Text = ""
txtProperty.Text = ""
txtInterpret.Text = ""


src = "SELECT * FROM specialWords WHERE id=" & deleteID
Data1.RecordSource = src
Data1.Refresh
If Not Data1.Recordset.BOF Then
 Data1.Recordset.Delete
End If
Data1.Recordset.Close

Call wordselect_Click

End Sub

Private Sub cmdSubmit_Click()

 wspell = Trim(txtSpell.Text)
 wproperty = Trim(txtProperty.Text)
 winterpret = Trim(txtInterpret.Text)
 wlen = Len(wspell)
 
 If wlen <= 0 Or wlen > 50 Then
 MsgBox "您填写的单词不符合设定的规则", vbInformation, "提示"
 txtSpell.SetFocus
 ElseIf LenB(wproperty) <= 0 Or LenB(wproperty) > 10 Then
 MsgBox "单词词性不符合设定的规则", vbInformation, "提示"
 txtProperty.SetFocus
 ElseIf LenB(winterpret) <= 0 Or LenB(winiterpret) > 50 Then
  MsgBox "单词词意不符合设定的规则", vbInformation, "提示"
 txtInterpret.SetFocus
 Else
  

  For i = 1 To wlen
   s = UCase(Mid(wspell, i, 1))
   If Asc(s) > 90 Or Asc(s) < 65 Then
    MsgBox "单词不符合英文的规则", vbInformation, "提示"
    txtSpell.SetFocus
    Exit Sub
   End If
  Next

topasc = UCase(Mid(wspell, 1, 1))
topasc = CInt(Asc(topasc))

    With Data1
   .Recordset.edit
   .Recordset("spell") = wspell
   .Recordset("property") = wproperty
   .Recordset("interpret") = winterpret
   .Recordset("topasc") = topasc
   .Recordset.Update
   .Recordset.Close
  End With
  
  'Data1.RecordSource = "UPDATE specialWords set spell=" & Chr(39) & wspell & Chr(39) & ",property=" & Chr(39) & wproperty & Chr(39) & ",interpret=" & Chr(39) & winterpret & Chr(39) & ",topasc=" & topasc & " WHERE id=" & id
  Data1.RecordSource = "SELECT * FROM specialWords WHERE id=" & id
  
  Data1.Refresh
  If Not Data1.Recordset.BOF Then
    With Data1
   .Recordset.edit
   .Recordset("spell") = wspell
   .Recordset("property") = wproperty
   .Recordset("interpret") = winterpret
   .Recordset("topasc") = topasc
   .Recordset.Update
  End With
 End If
 Data1.Recordset.Close
  txtSpell.Text = ""
  txtProperty.Text = ""
  txtInterpret.Text = ""
  MsgBox "单词" & txtSpell & "成功编辑!", vbInformation, "提示"
  
  
End If


End Sub

Private Sub Form_Load()
 
 stylecolor = Trim(CONFSTR.stylecolor)
 Me.BackColor = stylecolor
 Frame1.BackColor = stylecolor
 Frame2.BackColor = stylecolor
 
 Data1.DatabaseName = ROOT & "/wordlib.mdb"
 Data1.RecordSource = "SELECT spell FROM words WHERE topasc = 65 ORDER BY spell ASC"
 Data1.Refresh
 
 For i = 65 To 90
  wordselect.AddItem (Chr(i))
 Next

Do While Not Data1.Recordset.EOF

wordList.AddItem Data1.Recordset("spell")

Data1.Recordset.MoveNext
Loop

'Data1.Recordset.Close
cmdDelete.Enabled = False
cmdSubmit.Enabled = False

End Sub

Private Sub wordList_Click()

 Dim src As String
 
 Data1.RecordSource = "SELECT * FROM words WHERE spell = " & Chr(39) & wordList.Text & Chr(39)
 
 Data1.Refresh

 With Data1

 id = .Recordset("id")
 txtSpell.Text = .Recordset("spell")
 txtProperty.Text = .Recordset("property")
 txtInterpret.Text = .Recordset("interpret")

 End With
cmdDelete.Enabled = True
cmdSubmit.Enabled = True

End Sub

Private Sub wordselect_Click()

 Dim s As Single
 If wordselect.Text = "" Then wordselect = "A"
  s = CInt(Asc(UCase(wordselect.Text)))
  If s < 65 Or s > 90 Then s = 65
  wordList.Clear
  
 Data1.RecordSource = "SELECT spell FROM words WHERE topasc = " & s & " ORDER BY spell ASC"
 Data1.Refresh

Do While Not Data1.Recordset.EOF
 wordList.AddItem Data1.Recordset("spell")
 Data1.Recordset.MoveNext
Loop
Data1.Recordset.Close

txtSpell.Text = ""
txtProperty.Text = ""
txtInterpret.Text = ""

cmdDelete.Enabled = False
cmdSubmit.Enabled = False

End Sub
 
Private Sub wordselect_Change()
 
 Call wordselect_Click

End Sub


⌨️ 快捷键说明

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