How to Add / Remove From Collection

C

Chuck Insight

Please Help a Novice with a WEB Form Problem.

I have discovered that both an Array and an ArrayList can contain a
collection of 300 integers. The things I cannot seem to figure out are:
1 - How to populate these objects,
2 - How to test the members to determine whether they contain a particular
value,
3 - How to delete or set to zero the member after it passes the test, and
4 - How to populate a different Array(List) with the value of the original
list.


I have also discovered a few methods within these classes such as .Equals
..Add .Remove .GetValue, which seem to hold significant parts of my answer;
but the book I have falls very short of explaining how to make them work the
way she indicates.

I would greatly appreciate any help (or a link to a tutor that shows
examples) that clearly explains how to deploy these methods.

Thanks very much,
Chuck
 
C

Chuck Insight

Please Help a Novice with a WEB Form Problem (Coded in VB - Sorry, I forgot
to mention that in my initial post.)

I have discovered that both an Array and an ArrayList can contain a
collection of 300 integers. The things I cannot seem to figure out are:
1 - How to populate these objects,
2 - How to test the members to determine whether they contain a particular
value,
3 - How to delete or set to zero the member after it passes the test, and
4 - How to populate a different Array(List) with the value of the original
list.


I have also discovered a few methods within these classes such as .Equals
..Add .Remove .GetValue, which seem to hold significant parts of my answer;
but the book I have falls very short of explaining how to make them work the
way she indicates.

I would greatly appreciate any help (or a link to a tutor that shows
examples) that clearly explains how to deploy these methods.

Thanks very much,
Chuck
 
K

Ken Cox [Microsoft MVP]

Hey Chuck,

It looks like you're taking too many shortcuts. Here's some code that works
for me. Does it work for you?

Ken
Microsoft MVP [ASP.NET]


<%@ Page Language="vb" AutoEventWireup="true" %>
<%@ Import namespace="System.Collections" %>
<%@ Import namespace="Microsoft.VisualBasic" %>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>arraylstscript</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<script runat='server' language="vb">
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs)

dim Samples as New ArrayList()
Samples.Add("1")
Samples.Add("2")
Samples.Add("3")
Samples.Add("4")
Samples.Add("5")
Samples.Add("6")
Samples.Add("7")
Samples.Add("8")
Samples.Add("9")
Samples.Add("10")
Samples.Add("11")
Samples.Add("12")
Samples.Add("13")
Samples.Add("14")
Samples.Add("15")
Samples.Add("16")
Samples.Add("17")
Samples.Add("18")
Samples.Add("19")
Samples.Add("20")
Samples.Add("21")
Samples.Add("22")
Samples.Add("23")
Samples.Add("24")
Samples.Add("25")
Samples.Add("26")
Samples.Add("27")
Samples.Add("28")
Samples.Add("29")
Samples.Add("30")

DropDownList1.DataSource = Samples
DropDownList1.DataBind()
end sub

</script>
</head>
<body MS_POSITIONING="FlowLayout">
<form id="Form1" method="post" runat="server">
<asp:dropdownlist id="DropDownList1"
runat="server"></asp:dropdownlist>
</form>
</body>
</html>
 
C

Chuck Insight

Thanks a 1,000,000 Ken.
You have officially become my hero.
Now that I have the hard part in place, I will try to finish the balance of
my project.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top