Why are HashTable Items Not Unique ???

C

Chuck Insight

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ Page Explicit = "True" Language="VB" Debug="True" %>
<%@ Import namespace="System.Collections" %>
<HTML>
<U>Show me the Numbers<BR></U>
<%Dim Balls as HashTable = New HashTable
Dim IndexBall As Integer = 0
Dim ItemNum As Integer = 0
For ItemNum = 1 to 50
Randomize
ItemNum = Int(Rnd * 48) + 1
IndexBall += 1
On Error Resume Next
Balls.Add(IndexBall, ItemNum)
Next ItemNum%>
<%=Balls(1)%><%=Balls(2)%><%=Balls(3)%><%=Balls(4)%><%=Balls(5)%><%=Balls(6)
%><BR>
<%=Balls(7)%><%=Balls(8)%><%=Balls(9)%><%=Balls(10)%><%=Balls(11)%><%=Balls(
12)%><BR>
<%=Balls(13)%><%=Balls(14)%><%=Balls(15)%><%=Balls(16)%><%=Balls(17)%><%=Bal
ls(18)%><BR>
<%=Balls(19)%><%=Balls(20)%><%=Balls(21)%><%=Balls(22)%><%=Balls(23)%><%=Bal
ls(24)%><BR>
<%=Balls(25)%><%=Balls(26)%><%=Balls(27)%><%=Balls(28)%><%=Balls(20)%><%=Bal
ls(30)%><BR>
<%=Balls(31)%><%=Balls(32)%><%=Balls(33)%><%=Balls(34)%><%=Balls(35)%><%=Bal
ls(36)%><BR>
<%=Balls(37)%><%=Balls(38)%><%=Balls(39)%><%=Balls(40)%><%=Balls(41)%><%=Bal
ls(42)%><BR>
<%=Balls(43)%><%=Balls(44)%><%=Balls(45)%><%=Balls(46)%><%=Balls(47)%><%=Bal
ls(48)%><BR>
<FORM NAME="Form1"><Center><Font color="#ff0000"><B>If You want To See More
Numbers,</Font>
<INPUT TYPE="Button" NAME="Play" VALUE="Click This Button"></B></Center>
<SCRIPT FOR="Play" EVENT="onClick"
LANGUAGE="VBScript"></Script></FORM></html>
 
C

Chuck Insight

Thanks for the reply Alvin.
After looking at the code, would you recommend that I switch what populates
what?
If so, my next dilemma is how to display the index value using the format
below.
Thanks for your continued support,
Chuck

Alvin Bruney said:
that's not possible, hashtables enforce unique constraints on keys. there
may be duplicated value items however.

--
Regards,
Alvin Bruney
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
available at www.lulu.com/owc
_________________________


Chuck Insight said:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ Page Explicit = "True" Language="VB" Debug="True" %>
<%@ Import namespace="System.Collections" %>
<HTML>
<U>Show me the Numbers<BR></U>
<%Dim Balls as HashTable = New HashTable
Dim IndexBall As Integer = 0
Dim ItemNum As Integer = 0
For ItemNum = 1 to 50
Randomize
ItemNum = Int(Rnd * 48) + 1
IndexBall += 1
On Error Resume Next
Balls.Add(IndexBall, ItemNum)
Next ItemNum%>
ls(48)%><BR>
<FORM NAME="Form1"><Center><Font color="#ff0000"><B>If You want To See
More
Numbers,</Font>
<INPUT TYPE="Button" NAME="Play" VALUE="Click This Button"></B></Center>
<SCRIPT FOR="Play" EVENT="onClick"
LANGUAGE="VBScript"></Script></FORM></html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top