关于运行时的哈希表 [英] About the hashtable at run time

查看:66
本文介绍了关于运行时的哈希表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好

如何在运行时向myhash添加新项目,我希望用户在运行时向哈希表中添加新项目,如果可能的话,我想要的代码在vb中没有c或c ++

我将显示所有代码:

Hello
How to add new items to myhash at run time , I want the user to add new items to hashtable at run time,if this is possible , the code I want it in vb not c or c++
and I will show the all code :

private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim Hash As New Hashtable")

    Hash.Add("1", "Jim Strong")
    Hash.Add("2","Mari Anthem")
    Hash.Add("3", "Pauly" )
    Hash.Add("4", "George Set")

    If Hash.ContainsKey(TextBox1.Text) Then
        Label1.Text = Hash.Item(TextBox1.Text)
    Else
        Label1.Text = "not in Hashtable"
    End If
End Sub

推荐答案

嗯...你已经在运行时将项目添加到哈希表中了!您认为Hash.Add语句的用途是什么?
Ummm... your already adding items to the hashlist at runtime! What do you think those Hash.Add statements are for?


这篇关于关于运行时的哈希表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆