快上网建站品牌

13518219792
  • 首页
  • 关于我们
    • 如何选择
    • 选择理由
  • 案例作品
    • 网站建设
    • 优化推广
    • 微信开发
    • 电商托管
  • 服务项目
    • 网站建设
    • 移动端/APP
    • 微信/小程序
    • 技术支持
    • 其它服务
  • 建站知识
    • 成都网站建设
    • 成都做网站
    • 成都网站设计
  • 网站售后
    • 成都网站运营
    • 成都网站维护
    • 成都网站推广
  • 客服中心
  • 全国分站

vb.net创建字典 vbnet dictionary

在VB.NET中字典对象是什么意思

你可以简单的理解为 定义一个字典对象 相当于定义一个二维数组 但是比数组使用起来方便快捷

创新互联长期为成百上千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为察哈尔右翼后企业提供专业的网站设计、网站建设,察哈尔右翼后网站改版等技术服务。拥有十多年丰富建站经验和众多成功案例,为您定制开发。

(高分求助)想要个密码字典生成的VB或VB.NET代码,生成任意字符串的所有排列组合,包括子字符串的排列组

你学过数学的话,就知道,这个字典会异常级别的大,如果是6位,就能达到20G~30G

用VB语言制作英汉小辞典

Public Class Form1

Inherits System.Windows.Forms.Form

Public filename As String = "英汉词典.txt"

Public myword(6500, 1) As String

Public words As Integer = 0

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim a As String

Dim b As Integer

Dim i As Integer = 0

Dim n As String

Dim m As String

Dim stringb As Integer

TextBox1.Text = ""

TextBox2.Text = ""

FileOpen(1, "英汉词典.txt", OpenMode.Input)

Do While Not EOF(1)

a = LineInput(1)

b = InStr(a, " ")

n = Microsoft.VisualBasic.Left(a, b - 1)

myword(i, 0) = n

ListBox1.Items.Add(n)

stringb = Len(a) - b

m = Trim(Microsoft.VisualBasic.Right(a, stringb))

myword(i, 1) = m

i += 1

Loop

words = i

FileClose(1)

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim i As Integer = -1

If TextBox1.Text = "" Then

MessageBox.Show("不能输入空格,请重新输入")

TextBox2.Text = ""

TextBox1.Focus()

Exit Sub

Else

For i = i + 1 To words

If LCase(TextBox1.Text) = LCase(myword(i, 0)) Then

TextBox2.Text = Trim(myword(i, 1))

Exit Sub

End If

Next

MessageBox.Show(" 您需要的单词不存在,请重新输入")

End If

End Sub

Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged

Try

TextBox1.Text = myword(ListBox1.SelectedIndex, 0)

TextBox2.Text = Trim(myword(ListBox1.SelectedIndex, 1))

Catch ex As Exception

End Try

Exit Sub

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

Dim ch, enterwords As String

Dim j, m As Integer

If -1 = ListBox1.SelectedIndex Then

MsgBox("请选择单词", , "")

ListBox1.Focus()

Exit Sub

End If

enterwords = InputBox("请修改单词", "修改单词", Trim(myword(ListBox1.SelectedIndex, 0)))

Do While enterwords = ""

m = MsgBox("单词不能为空", MsgBoxStyle.RetryCancel, "修改单词")

If m = 4 Then

enterwords = InputBox("请修改单词", "修改单词", Trim(myword(ListBox1.SelectedIndex, 0)))

Else

Exit Sub

End If

Loop

ch = InputBox("请修改中文意思", "修改单词", Trim(myword(ListBox1.SelectedIndex, 1)))

Do While ch = ""

m = MsgBox("中文意思不能为空", MsgBoxStyle.RetryCancel, "修改单词")

If m = 4 Then

ch = InputBox("请修改中文意思", "修改单词", Trim(myword(ListBox1.SelectedIndex, 1)))

Else

Exit Sub

End If

Loop

myword(ListBox1.SelectedIndex, 1) = ch

myword(ListBox1.SelectedIndex, 0) = enterwords

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.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

这是代码,文字性的内容自己去做。


网站标题:vb.net创建字典 vbnet dictionary
当前网址:http://csdahua.cn/article/doiddig.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流

其他资讯

  • otg给电脑装系统
  • pe下给电脑装系统
  • web怎么加入css样式 web中怎么添加背景图片
  • ios共享屏幕上开发 ios15 共享屏幕
  • pc装苹果电脑系统

行业动态

企业网站建设的重要性!

现在虽然是移动互联网时代,但企业网站依然重要,包含PC站点,移动站。可以说企业网站关系企业的未来发展和前途,尤其对中小企业更是如此,一些中小企业老板,对自己的名片很在乎,因为这是个门面。...

服务项目

  • 网站建设

    查看详情
  • 移动端/APP

    查看详情
  • 微信/小程序

    查看详情
  • 技术支持

    查看详情
  • 其它服务

    查看详情
  • 更多服务项目

    用我们的专业和诚信赢得您的信赖,从PC到移动互联网均有您想要的服务!

    获取更多

联系吧 在百度地图上找到我们

电话:13518219792

如遇占线或暂未接听请拨:136xxx98888

业务咨询 技术咨询 售后服务
网站制作
梓潼网站制作公司
盐亭网站制作公司
温江网站制作
成都网站制作
网站建设
成都网站建设
手机网站建设
江油网站建设
成都响应式网站建设
网站设计
成都网站设计
专业网站设计
企业网站设计
网站设计制作报价
联系我们
电话:13518219792
邮箱:631063699@qq.com
地址:成都青羊区锦天国际1002号
网址:www.csdahua.cn

微信二维码

  • 友情链接
  • 遂宁网站建设
  • 彭州做网站
  • cdpolo.cn
  • 资阳柴油发电机
  • 成都租用服务器
  • 成都棕树电信机房
  • shufengxianlan.com
  • 四川正泰动物
  • 达州网站建设
  • 虚拟主机

Copyright © 2002-2023 www.csdahua.cn 快上网建站品牌 QQ:244261566 版权所有 备案号:蜀ICP备19037934号

  • 在线咨询
  • 13518219792
  • 微信二维码

  • 移动版官网