张小小晴晴
窗体1:Dim vb As ECPrivate Sub Timer1_Timer() If Label3.Left + Label3.Width > 0 Then Label3.Move Label3.Left - 60 Else Label3.Left = frmYH.ScaleWidth End IfEnd SubPrivate Sub cmdAdd_Click()Dim w() As ECDim i%Dim j%Dim n%Dim p%i = 1txtWord.Text = " "txtmean.Text = " "Open "c:\cc5.txt" For Random As #1 Len = Len(vb)While Not EOF(1)Get #1, i, vbi = 1 + iWendp = i - 1n = InputBox("请输入要添加的单词个数")ReDim w(n)For j = 1 To nw(j).Word = InputBox("请输入单词")w(j).Explon = InputBox("请输入解释")vb = w(j)Put #1, p, vbp = p + 1Next jMsgBox "添加成功"Close #1End SubPrivate Sub cmdDel_Click()Dim s As String * 10Dim fn As StringDim t1%Dim t2%Dim i%Dim b%Dim j%Dim g%Dim m%Text1.Text = " "Text2.Text = " "s = InputBox("请输入要删除的单词")Open "c:\cc5.txt" For Random As #1 Len = Len(vb)i = 1Do Until EOF(1)Get #1, i, vbIf Trim(s) = Trim(vb.Word) Thenb = iExit DoEnd Ifi = i + 1LoopIf Trim(s) <> Trim(vb.Word) ThenMsgBox "没有这个单词"Close #1Exit SubEnd Ifm = 1Do Until EOF(1) Get #1, m, vb m = m + 1 Loop m = m - 1 fn = "c:\cc4.txt" Select Case b Case 1 Open fn For Random As #2 Len = Len(vb) j = 1 g = 2 Do Until EOF(1) Get #1, g, vb Put #2, j, vb j = j + 1 g = g + 1LoopClose #1Kill "c:\cc5.txt"MsgBox "删除成功" Case 2 To m - 1Open fn For Random As #2 Len = Len(vb) j = 1 For x = 1 To b - 1 Get #1, x, vb Put #2, j, vb j = j + 1 Next xDo Until EOF(1) Get #1, b + 1, vb Put #2, j - 1, vb b = b + 1 j = j + 1 Loop Close #1 Kill "c:\cc5.txt" MsgBox "删除成功" Case m Open fn For Random As #2 Len = Len(vb)For j = 1 To m - 1 Get #1, j, vb Put #2, j, vb Next j Close #1 Kill "c:\cc5.txt" MsgBox "删除成功" End Select Close #2Open "c:\cc5.txt" For Random As #1 Len = Len(vb)Open "c:\cc4.txt" For Random As #2 Len = Len(vb)j = 1Do Until EOF(2) Get #2, j, vb Put #1, j, vb j = j + 1LoopClose #1Close #2Kill "c:\cc4.txt"End SubPrivate Sub cmdEixt_Click()EndEnd SubPrivate Sub cmdFind_Click()Dim t As String * 10Dim i%i = 1t = txtWord.TextOpen "c:\cc5.txt" For Random As #1 Len = Len(vb)Do Until EOF(1)Get #1, i, vbIf Trim(t) = Trim(vb.Word) Thentxtmean.Text = vb.ExplonExit DoEnd Ifi = i + 1 LoopIf Trim(t) <> Trim(vb.Word) ThenMsgBox "找不到这个单词" End IfClose #1End SubPrivate Sub Form_Load() Dim vb As ECOpen "c:\cc5.txt" For Random As #1 Len = Len(vb)For i=1 to 100vb.Word = inputbox("输入单词")vb.Explon = inputbox("输入释义")Put #1, i, vbNext iClose #1End Sub模块:Type ECWord As String * 10Explon As String * 8End Type