vb.net应用字典 vb 字典( 二 )


For j = 0 To words - 1
PrintLine(1, myword(j, 0)" "myword(j, 1))
Next
FileClose(1)
MsgBox("修改成功")
ListBox1.Items.Clear()
Form1_Load(sender, e)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim i As Integer = 0
Dim k, m As Integer
Dim enterwords, ch As String
enterwords = InputBox("请输入要添加的单词", "添加单词")
Do While enterwords = ""
m = MsgBox("单词不能为空,请输入单词!", MessageBoxButtons.RetryCancel, "添加单词")
If m = 4 Then
enterwords = InputBox("请输入要添加的单词", "添加单词")
Else
Exit Sub
End If
Loop
ch = InputBox("请输入中文意思", "添加中文")
Do While ch = ""
m = MsgBox("中文不能为空,请输入中文意思!", MessageBoxButtons.RetryCancel, "添加中文")
If m = 4 Then
ch = InputBox("请输入中文意思", "添加中文")
Else
Exit Sub
End If
Loop
Do While LCase(myword(i, 0))LCase(enterwords)
i = i + 1
If words = i Then
myword(i, 0) = enterwords
myword(i, 1) = ch
words = words + 1
FileOpen(1, filename, OpenMode.Output)
For i = 0 To words - 1
PrintLine(1, myword(i, 0)" "myword(i, 1))
Next
ListBox1.Items.Clear()
FileClose(1)
ListBox1.Items.Clear()
Form1_Load(sender, e)
MessageBox.Show("添加成功")
Exit Sub
End If
Loop
If LCase(myword(i, 0)) = LCase(enterwords) Then
MessageBox.Show("该单词已存在!")
ListBox1.SelectedIndex = i
Exit Sub
ElseIf LCase(myword(0, 0))LCase(enterwords) Then
For k = words To 0 Step -1
myword(k + 1, 0) = myword(k, 0)
myword(k + 1, 1) = myword(k, 1)
Next
myword(0, 0) = enterwords
myword(0, 1) = ch
words = words + 1
FileOpen(1, filename, OpenMode.Output)
For i = 0 To words - 1
PrintLine(1, myword(i, 0)" "myword(i, 1))
Next
ListBox1.Items.Clear()
FileClose(1)
Form1_Load(sender, e)
MessageBox.Show("添加成功")
Exit Sub
End If
For k = words To i + 1 Step -1
myword(k + 1, 0) = myword(k, 0)
myword(k + 1, 1) = myword(k, 1)
Next k
myword(i, 0) = enterwords
myword(i, 1) = ch
words = words + 1
FileOpen(1, filename, OpenMode.Output)
For i = 0 To words - 1
PrintLine(1, myword(i, 0)" "myword(i, 1))
Next
FileClose(1)
ListBox1.Items.Clear()
Form1_Load(sender, e)
MessageBox.Show("添加成功")
Exit Sub
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim i, j, k As Integer
If -1 = ListBox1.SelectedIndex Then
MsgBox("请选择单词", , "")
ListBox1.Focus()
Exit Sub
End If
k = MsgBox("确定是否删除", MsgBoxStyle.YesNo, "提示")
If k = 6 Then
For i = ListBox1.SelectedIndex To words
myword(i, 0) = myword(i + 1, 0)
myword(i, 1) = myword(i + 1, 1)
Next
words = words - 1
FileOpen(1, filename, OpenMode.Output)
For j = 0 To words - 1
PrintLine(1, myword(j, 0)" "myword(j, 1))
Next
FileClose(1)
MsgBox("单词已删除")
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
ListBox1.Refresh()
TextBox1.Text = ""
TextBox2.Text = ""
Exit Sub
Else
Exit Sub
End If
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
End Class
这是代码,文字性的内容自己去做 。
VS 中如何使用字典,像VB中字典的用法一样在线翻译网址 1、世界通文本文件英-汉、汉-英翻译 , 网页英、日、汉(繁、简)互译 , 邮件中、英互译 , 双语搜索等 。2、联通翻译提供英、汉(简体)、日、俄、德等语种的浏览翻译、即时翻译、上载翻译、邮件翻译 。目前只对中国联通宽带用户及其165拨号上网用户**开放 。3、华建翻译浏览翻译、 即时翻译 、 上载翻译、邮件翻译、双语纵横 、网络词海,原文语种有vb.net应用字典:英语、汉语(简体)、汉语(繁体)、日语、俄语、德语,译文语种有vb.net应用字典:英语、汉语(简体)、汉语(繁体)、日语建站的宗旨是为了宏扬中华文化,继承优良传统 , 推广学习汉语,规范汉字使用,为广大网民提供便利

推荐阅读