Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. how to get value from hash table

how to get value from hash table

Scheduled Pinned Locked Moved ASP.NET
data-structurescryptographyhelptutorial
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Piyush Vardhan Singh
    wrote on last edited by
    #1

    hi friend i have hash table where we store key and value. on value place i stored one more hash table so how i get that value which is store in value hash table help me

    Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

    M D 2 Replies Last reply
    0
    • P Piyush Vardhan Singh

      hi friend i have hash table where we store key and value. on value place i stored one more hash table so how i get that value which is store in value hash table help me

      Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

      M Offline
      M Offline
      Mubashir Javaid
      wrote on last edited by
      #2

      Hi Friend: Here is code for getting child hashtable value. //Make main Hash table Hashtable mainHashTable = new Hashtable(); //Make child Hash Table Hashtable childHashTable = new Hashtable(); //Add child hash table value childHashTable.Add("ChildValue", "Mubashir"); //Add child hash table to main hash table mainHashTable.Add("HashTable", childHashTable); //Get Child Hash table value ((Hashtable)mainHashTable["HashTable"])["ChildValue"].ToString()

      P 1 Reply Last reply
      0
      • M Mubashir Javaid

        Hi Friend: Here is code for getting child hashtable value. //Make main Hash table Hashtable mainHashTable = new Hashtable(); //Make child Hash Table Hashtable childHashTable = new Hashtable(); //Add child hash table value childHashTable.Add("ChildValue", "Mubashir"); //Add child hash table to main hash table mainHashTable.Add("HashTable", childHashTable); //Get Child Hash table value ((Hashtable)mainHashTable["HashTable"])["ChildValue"].ToString()

        P Offline
        P Offline
        Piyush Vardhan Singh
        wrote on last edited by
        #3

        but i have many walu in child hash table like this:- Dim ConfId As String Dim meesage As String Dim SinglNode As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference") ConfId = SinglNode.Attributes("confId").InnerText Dim SinglNode1 As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference/messageReceived/message/content") If SinglNode1.InnerText <> "" Then meesage = SinglNode1.InnerText 'M_MessageTextHTAble = M_MessageHTAble.Item(ConfId) M_Messagecounter = M_Messagecounter + 1 M_MessageTextHTAble.Add(M_Messagecounter, meesage) M_MessageHTAble.Remove(ConfId) M_MessageHTAble.Add(ConfId, M_MessageTextHTAble) End If Return M_MessageHTAble

        Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

        P M 2 Replies Last reply
        0
        • P Piyush Vardhan Singh

          but i have many walu in child hash table like this:- Dim ConfId As String Dim meesage As String Dim SinglNode As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference") ConfId = SinglNode.Attributes("confId").InnerText Dim SinglNode1 As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference/messageReceived/message/content") If SinglNode1.InnerText <> "" Then meesage = SinglNode1.InnerText 'M_MessageTextHTAble = M_MessageHTAble.Item(ConfId) M_Messagecounter = M_Messagecounter + 1 M_MessageTextHTAble.Add(M_Messagecounter, meesage) M_MessageHTAble.Remove(ConfId) M_MessageHTAble.Add(ConfId, M_MessageTextHTAble) End If Return M_MessageHTAble

          Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

          P Offline
          P Offline
          Parwej Ahamad
          wrote on last edited by
          #4

          Step 1 : Get the Fist M_MessageTextHTAble from the M_MessageHTAble by ConfId Step 2 : Get the all item from M_MessageTextHTAble by For each statement

          Parwej Ahamad g.parwez@gmail.com

          1 Reply Last reply
          0
          • P Piyush Vardhan Singh

            but i have many walu in child hash table like this:- Dim ConfId As String Dim meesage As String Dim SinglNode As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference") ConfId = SinglNode.Attributes("confId").InnerText Dim SinglNode1 As System.Xml.XmlNode = xRequests.SelectSingleNode("/cwaEvents/conference/messageReceived/message/content") If SinglNode1.InnerText <> "" Then meesage = SinglNode1.InnerText 'M_MessageTextHTAble = M_MessageHTAble.Item(ConfId) M_Messagecounter = M_Messagecounter + 1 M_MessageTextHTAble.Add(M_Messagecounter, meesage) M_MessageHTAble.Remove(ConfId) M_MessageHTAble.Add(ConfId, M_MessageTextHTAble) End If Return M_MessageHTAble

            Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

            M Offline
            M Offline
            Mubashir Javaid
            wrote on last edited by
            #5

            This code works for you. You can add different items in child node. These item can be of any type. All you need is type casting. Lets suppose you added SinglNode of XMLNode type in child hash table. You shall use this line for getting that object ((XMLNode)((Hashtable)mainHashTable["HashTable"])["ChildValue"])) This line first get the value of child table then convert it to XMLNode. You can add multiple different objects in hash table. //Make main Hash table Hashtable mainHashTable = new Hashtable(); //Make child Hash Table Hashtable childHashTable = new Hashtable(); //Add child hash table value childHashTable.Add("ChildValue", "Mubashir"); //Add child hash table to main hash table mainHashTable.Add("HashTable", childHashTable); //Get Child Hash table value ((Hashtable)mainHashTable["HashTable"])["ChildValue"].ToString()

            1 Reply Last reply
            0
            • P Piyush Vardhan Singh

              hi friend i have hash table where we store key and value. on value place i stored one more hash table so how i get that value which is store in value hash table help me

              Piyush Vardhan Singh Programmer TAS NewDelhi India 9313077379

              D Offline
              D Offline
              Dr_X
              wrote on last edited by
              #6

              This helpful to extract the whole list of key & values when debugging:

              Public Shadows Function ToString(ByVal hashTable As Hashtable) As String
                Dim s As String = String.Empty
                Dim enumerator As IDictionaryEnumerator = hashTable.GetEnumerator()
              
                While (enumerator.MoveNext())
                  s += enumerator.Key & ": " & enumerator.Value & ControlChars.NewLine
                End While
                Return s
              End Function
              

              Michael

              I firmly believe that any man's finest hour, the greatest fulfillment of all that he holds dear, is that moment when he has worked his heart out in a good cause and lies exhausted on the field of battle - victorious. Vince Lombardi (1913-1970)

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups