Professional Web Applications Themes

How can I display hashtable key values in a web page? - ASP.NET Data Grid Control

Here is my first attempt at populating the hashtable. dim t as hashtable = new hashtable() dim k as integer = t.key dim v as integer = t.value v = 0 for k = 1 to 200 on error goto bottom if t.count = 50 then goto exit end if k = int(rnd * 50) +1 v += 1 t.add(k) :bottom next k :exit...

  1. #1

    Default How can I display hashtable key values in a web page?

    Here is my first attempt at populating the hashtable.

    dim t as hashtable = new hashtable()
    dim k as integer = t.key
    dim v as integer = t.value
    v = 0
    for k = 1 to 200
    on error goto bottom
    if t.count = 50 then
    goto exit
    end if
    k = int(rnd * 50) +1
    v += 1
    t.add(k)
    :bottom
    next k
    :exit


    Chuck Insight Guest

  2. #2

    Default Re: How can I display hashtable key values in a web page?

    Chuck, looking at your code, I am not sure what you are trying to
    accomplish but the Hashtable.Keys is an ICollection container. Then you
    can loop through the collection and display the keys.

    Jason Bentley
    [url]http://geekswithblogs.net/jbentley[/url]

    Jason Bentley Guest

  3. #3

    Default Re: How can I display hashtable key values in a web page?

    Thank you very much for that information.

    Next, would you please be more specific about exactly how to actually
    accomplish displaying the values of the keys in the sequence they were
    produced.

    I tried <#= %> and <%= %> both throw an error.

    Thanks for your continued assistance,
    Chuck

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Chuck Bauer Guest

  4. #4

    Default Re: How can I display hashtable key values in a web page?

    Chuck, first, when you loop through the collection, the contents will
    not necessarily be in the order they were created. Can you give a
    thorough expanation of what you are doing? As far as displaying inline
    code, <%= %> should work but can you post your full code now.

    Jason Bentley
    [url]http://geekswithblogs.net/jbentley[/url]

    Jason Bentley Guest

  5. #5

    Default Re: How can I display hashtable key values in a web page?

    Thanks for the reply Jason.

    To answer your question, I am trying to create a collection of 50 unique
    random numbers.
    Recording them as the key value assures this.
    If the random number generated already exists, I direct it to :Bottom, which
    simply requests another random number.
    On the other hand, if the newly generated number is unique, I increment a
    counter.
    The counter number is the value half of the table.

    I know hashtables don't provide output in a predefined sequence without
    help.
    So, my plan to display the key-value pair sequenced according the value.
    This leads me to my initial question, which is "How can I display hashtable
    key values in a web page?"

    Thanks again,
    Chuck


    "Jason Bentley" <imsinc> wrote in message
    news:1111980583.433257.282270f14g2000cwb.googlegr oups.com...
    > Chuck, first, when you loop through the collection, the contents will
    > not necessarily be in the order they were created. Can you give a
    > thorough expanation of what you are doing? As far as displaying inline
    > code, <%= %> should work but can you post your full code now.
    >
    > Jason Bentley
    > [url]http://geekswithblogs.net/jbentley[/url]
    >

    Chuck Insight Guest

  6. #6

    Default Re: How can I display hashtable key values in a web page?

    Chuck, this code will print out a list of integers from 200 to 1 from
    the Hashtable.

    Dim t As Hashtable = New Hashtable
    For I As Integer = 1 To 200
    t.Add(I, I)
    Next
    Dim keyCollection As ICollection = t.Keys
    Dim looper As IEnumerator = keyCollection.GetEnumerator()

    Do While looper.MoveNext()
    Response.Write(Convert.ToString(looper.Current) & "<BR>")
    Loop

    Is this what you are looking for?

    Jason Bentley
    [url]http://geekswithblogs.net/jbentley[/url]

    Jason Bentley Guest

Similar Threads

  1. Question i need to display 3 decimal values in my output
    By Unregistered in forum Brainstorming Area
    Replies: 0
    Last Post: September 12th, 07:29 AM
  2. Can't display initial XML values
    By DrawQuarter in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: April 3rd, 03:42 PM
  3. unable to display all values in recordset
    By braulio! in forum Coldfusion - Getting Started
    Replies: 6
    Last Post: September 20th, 02:12 AM
  4. I cant display recordset values of only what a visitorselects
    By braulio! in forum Coldfusion - Getting Started
    Replies: 11
    Last Post: September 18th, 01:56 AM
  5. GD::Graph::Pie display values
    By Bill McCormick in forum PERL Modules
    Replies: 1
    Last Post: November 29th, 04:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139