473,473 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Array type

Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

Nov 19 '05 #1
6 1175
On Wed, 26 Jan 2005 12:33:22 -0500, "Maziar Aflatoun"
<ma***@rogers.com> wrote:
Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

http://www.w3schools.com/aspnet/aspnet_hashtable.asp

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #2
I have seen this but as far as I know it doesn't let me find out the array
index. For example search for a key or value and returning the index number.
Any idea?

Thanks
Maz.
"teknohippy" <an******@me.com> wrote in message
news:vl********************************@4ax.com...
On Wed, 26 Jan 2005 12:33:22 -0500, "Maziar Aflatoun"
<ma***@rogers.com> wrote:
Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

http://www.w3schools.com/aspnet/aspnet_hashtable.asp

--
Iain Norman | http://www.eliteforum.org

Nov 19 '05 #3
Yes, the hashtable won't work well for your needs.

You'll have to create your own custom collection either by inheriting
CollectionBase, or since you have similar needs as a HashTable and Arraylist
from one of those two.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:Er********************@rogers.com...
I have seen this but as far as I know it doesn't let me find out the array
index. For example search for a key or value and returning the index number. Any idea?

Thanks
Maz.
"teknohippy" <an******@me.com> wrote in message
news:vl********************************@4ax.com...
On Wed, 26 Jan 2005 12:33:22 -0500, "Maziar Aflatoun"
<ma***@rogers.com> wrote:
Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

http://www.w3schools.com/aspnet/aspnet_hashtable.asp

--
Iain Norman | http://www.eliteforum.org


Nov 19 '05 #4
"Maziar Aflatoun" <ma***@rogers.com> confessed in news:Er2dnaiLktvHRmrcRVn-
tw@rogers.com:
I have seen this but as far as I know it doesn't let me find out the array index. For example search for a key or value and returning the index number. Any idea?

Thanks
Maz.
"teknohippy" <an******@me.com> wrote in message
news:vl********************************@4ax.com...
On Wed, 26 Jan 2005 12:33:22 -0500, "Maziar Aflatoun"
<ma***@rogers.com> wrote:
Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

http://www.w3schools.com/aspnet/aspnet_hashtable.asp

--
Iain Norman | http://www.eliteforum.org



Is this what you're looking for?
// here's the Name/Value structure

public struct NameValue
{
private string theName;
private int theValue;

public NameValue(string aName , int Id)
{
theName = aName;
theValue = Id;
}
public string getName
{
get {return theName;}
}

public int getValue
{
get {return theValue;}
}
}

// then when I use it:

System.Collections.ArrayList theList = new ArrayList();

while (something)
{
int aVal;
string aName;

aVal = x;
aName = y;

theList.Add(new NameValue(aName, aVal));
}
Is that what you're looking for? (I use this kind of code to initialize
DropDownList controls from s datastore.)
-- ipgrunt

Nov 19 '05 #5
On Wed, 26 Jan 2005 13:03:11 -0500, "Maziar Aflatoun"
<ma***@rogers.com> wrote:
I have seen this but as far as I know it doesn't let me find out the array
index. For example search for a key or value and returning the index number.
Any idea?

Thanks
Maz.

Sorry that was a last thing, skim read, I'm a tosser cockup and a
half.

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #6
System.Collection.SortedList might work like you are expecting.

bill
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:gu********************@rogers.com...
Hi everyone,

Is there a type of array that would do the follow?
Store key/value pair
Return the current index in the array for a key or value?

BTW, I also need to bind it to a dropdown list .

Than you
Maz.

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: lawrence | last post by:
I wanted to test xml_parse_into_struct() so I took the example off of www.php.net and put this code up on a site: <?php $simple = <<<END <item>
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
29
by: shmartonak | last post by:
For maximum portability what should the type of an array index be? Can any integer type be used safely? Or should I only use an unsigned type? Or what? If I'm using pointers to access array...
11
by: truckaxle | last post by:
I am trying to pass a slice from a larger 2-dimensional array to a function that will work on a smaller region of the array space. The code below is a distillation of what I am trying to...
8
by: intrepid_dw | last post by:
Hello, all. I've created a C# dll that contains, among other things, two functions dealing with byte arrays. The first is a function that returns a byte array, and the other is intended to...
5
by: Stacey Levine | last post by:
I have a webservice that I wanted to return an ArrayList..Well the service compiles and runs when I have the output defined as ArrayList, but the WSDL defines the output as an Object so I was...
24
by: Michael | last post by:
Hi, I am trying to pass a function an array of strings, but I am having trouble getting the indexing to index the strings rather than the individual characters of one of the strings. I have...
17
by: =?Utf-8?B?U2hhcm9u?= | last post by:
Hi Gurus, I need to transfer a jagged array of byte by reference to unmanaged function, The unmanaged code should changed the values of the array, and when the unmanaged function returns I need...
0
by: anuptosh | last post by:
Hi, I have been trying to run the below example to get a Oracle Array as an output from a Java code. This is an example I have found on the web. But, the expected result is that the code should...
152
by: vippstar | last post by:
The subject might be misleading. Regardless, is this code valid: #include <stdio.h> void f(double *p, size_t size) { while(size--) printf("%f\n", *p++); } int main(void) { double array = { {...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.