
正文
vb.net如何声明字典 vbnet 字典
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
VS 中如何使用字典,像VB中字典的用法一样
在线翻译网址 1、世界通 文本文件英-汉、汉-英翻译,网页英、日、汉(繁、简)互译,邮件中、英互译,双语搜索等。 2、联通翻译 提供英、汉(简体)、日、俄、德等语种的浏览翻译、即时翻译、上载翻译、邮件翻译。 目前只对中国联通宽带用户及其165拨号上网用户**开放。 3、华建翻译 浏览翻译、 即时翻译 、 上载翻译、邮件翻译、双语纵横 、网络词海,原文语种有:英语、汉语(简体)、汉语(繁体)、日语、俄语、德语,译文语种有:英语、汉语(简体)、汉语(繁体)、日语 建站的宗旨是为了宏扬中华文化,继承优良传统,推广学习汉语,规范汉字使用,为广大网民提供便利
相关问答
Q1: vb.net中怎么样声明FindWindow和GetWindowThreadProcessId方法啊?还有“user32.dll”里面的方法能查看吗
Declare Function FindWindow Lib "user32" Alias "FindWindowA"
(ByVal lpClassName As String, ByVal lpWindowName As String) As Int32
Declare Function GetWindowThreadProcessId Lib "user32" Alias
"GetWindowThreadProcessId" (ByVal hwnd As Int32, lpdwProcessId As Int32) As
Int32
跟 VB6 里的声明没什么区别,只不过 Long 要变成 Int32 而已。
user32.dll 是 Windows 用户界面相关应用程序接口,用于包括 Windows 处理,基本用户界面等特性,如创建窗口和发送消息。所以和这些相关的 API 都封装在这里。但并不是所有的接口都对用户开放了,只开放了部分,也就是在编程中能调用的 API,所以要查看起来的话不容易。
Q2: 如何在Excel VBA中使用字典Dictionary对象
在VBA中使用字典分为前期绑定和后期绑定两种方式vb.net如何声明字典,
一、前期绑定vb.net如何声明字典:打开VBE编辑器,按下图操作,勾选相应选项就可以直接使用字典vb.net如何声明字典了。
二、后期绑定:如下代码即创建了一个名称为d的字典。
Set d = CreateObject("scripting.dictionary")
Q3: vb.net2010中的隐式声明和显示声明分别是什么
隐式声明就是指在使用某个变量之前,没有专门对其进行声明,
比如有个变量 J ,现在用DIM J AS ...对它进行专门vb.net如何声明字典的声明.就用它: J = 5 这就是隐式声明.
隐式声明会有一些风险.比如会写错变量明,使得前后本来要使用vb.net如何声明字典的是同一个变量的,却变成vb.net如何声明字典了两个.
显式声明和隐式声明相反,就是在用变量之前,对它进行vb.net如何声明字典了专门的声明.如:
dim a as string
a = "abc"
----------------------
在编程之前可以对程序进行设置,在编辑器的选项设置里 - VB默认值中 ,有个
Option Explicit 属性,如果选择ON,则会在写程序时,要求强制显式声明变量.如果没有进行显示声明的变量,在使用的时候会报错.
也可以在程序前使用 Option Explicit On 语句,来开启强制显式声明...
-------------------------
这么解释能理解吧?
Q4: 用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
这是代码,文字性的内容自己去做。
Q5: (高分求助)想要个密码字典生成的VB或VB.NET代码,生成任意字符串的所有排列组合,包括子字符串的排列组
你学过数学的话,就知道,这个字典会异常级别的大,如果是6位,就能达到20G~30G
关于vb.net如何声明字典和vbnet 字典的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







