1、首先点击打开主菜单栏中的“外接程序”选项。
2、然后在d出来的窗口中点击打开“可视化数据管理器”,出现下图中的界面。
3、然后单击文件中的新建,选择“microsot access”,“version 7.0”,d出保存界面,点击保存后出现如下界面。
4、然后右键单击properties,选择“新建表”,输入表名称,添加字段。
5、然后打开类型,选择字段类型的大小,回车确定。
6、然后点击“生成表”选项。
7、然后双击“1”或者右键单击选择打开。
8、然后输入值后工具栏会变化。
9、然后点击添加就完成了。
代码:
Private Type WordEnglish As String * 20
Chinese As String * 20
End Type
Private Sub AddWord_Click()
Frame1.Visible = True
List1.Visible = False
End Sub
Private Sub Command1_Click()
Dim Vocabulary As Word
Vocabulary.English = Text1.Text
Vocabulary.Chinese = Text2.Text
Open "C:\Users\Administrator\Desktop\词库.dat" For Random As #1 Len = Len(Vocabulary)
Put #1, LOF(1) / Len(Vocabulary) + 1, Vocabulary
Label3.Caption = "目前词库单词个数:" + CStr(LOF(1) / Len(Vocabulary))
Close #1
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command2_Click()
List1.Clear
Dim Vocabulary As Word
Dim a() As Boolean, n As Integer, RecordID As Integer, k As Integer
Open "C:\Users\Administrator\Desktop\词库.dat" For Random As #1 Len = Len(Vocabulary)
For i = 1 To LOF(1) / Len(Vocabulary)
Get #1, i, Vocabulary
List1.AddItem "(" + CStr(i) + ") " + Trim(Vocabulary.English) + Space(1) + Trim(Vocabulary.Chinese)
Next i
Close #1
List1.Visible = True
End Sub
Private Sub Command3_Click()
List1.Visible = False
End Sub
Private Sub Form_Load()
Frame1.Visible = False
List1.Visible = False
Frame1.Left = 100
Frame1.Top = 100
List1.Left = 100
List1.Top = 100
End Sub
Private Sub Recite_Click()
List1.Clear
Randomize
Frame1.Visible = False
Dim Num As Integer, EnglishWord As String, RightNumber As Integer, VocabularyChinese As String
Num = InputBox("请输入要背诵单词的个数:", "背诵单词", 10)
Dim Vocabulary As Word
Dim a() As Boolean, RecordID As Integer, Counter As Integer
Open "C:\Users\Administrator\Desktop\词库.dat" For Random As #1 Len = Len(Vocabulary)
ReDim a(1 To LOF(1) / Len(Vocabulary))
For i = 1 To LOF(1) / Len(Vocabulary)
a(i) = False
Next i
Do
RecordID = Int(Rnd * (LOF(1) / Len(Vocabulary)) + 1)
If a(RecordID) = False Then
Get #1, RecordID, Vocabulary
For i = 1 To 20
If Mid(Vocabulary.Chinese, i, 1) = " " Then
VocabularyChinese = Left(Vocabulary.Chinese, i - 1)
Exit For
End If
Next i
EnglishWord = InputBox("(" + CStr(Counter + 1) + ")" + Space(1) + Vocabulary.Chinese, "请根据下面出示的中文输入对应的英文单词(共" + CStr(Num) + "个单词)")
If EnglishWord = Trim(Vocabulary.English) Then
RightNumber = RightNumber + 1
List1.AddItem "(" + CStr(Counter + 1) + ")" + Space(1) + VocabularyChinese + Space(1) + "→" + Space(1) + EnglishWord + Space(1) + "√"
Else
List1.AddItem "(" + CStr(Counter + 1) + ")" + Space(1) + VocabularyChinese + Space(1) + "→" + Space(1) + EnglishWord + Space(1) + "×" + Space(1) + Trim(Vocabulary.English)
End If
a(RecordID) = True
Counter = Counter + 1
End If
Loop Until Counter = Num
Label5.Caption = "共默写了" + CStr(Num) + "个单词,其中写对" + CStr(RightNumber) + "个,写错" + CStr(Num - RightNumber) + "个。"
Close #1
List1.Visible = True
End Sub
菜单编辑:
界面设计:
运行界面:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)