473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

storing info into array

5
Hi, i am having trouble retrieving information from checkbox(from previous page) and storing it into this array as i do not wish to hard code the size of the array. can anyone help?

Expand|Select|Wrap|Line Numbers
  1. {
  2.             String[] item = new String[0];
  3.  
  4.             item = Request.Form.GetValues("cbBrand");
  5.             Label1.Text = item[0];
  6.         }
  7.  
Jul 19 '10 #1
6 1949
weaknessforcats
9,208 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. String[] item = new String[0]; 
You are allocating an array of 0 elements.

Maybe you need at least one String:

Expand|Select|Wrap|Line Numbers
  1. String[] item = new String;
or

Expand|Select|Wrap|Line Numbers
  1. String[] item = new String[1]; 
Jul 20 '10 #2
zeejay
5
yea erm... thats the part i would not like to hard code bro..
Jul 21 '10 #3
weaknessforcats
9,208 Expert Mod 8TB
Are you by chance thinking of an array of String?

In this case you use a vector:

Expand|Select|Wrap|Line Numbers
  1. vector<String> v;
Now you can add String objects until the cows come home.

vector<> implements an array. Check it out.
Jul 21 '10 #4
zeejay
5
@weaknessforcats
i have this page call "checkboxpage.aspx" checkboxpage is where i get the checkbox values from.. so on "callingpage.aspx.cs"
i m trying to call the values from the checkbox in "checkboxpage.aspx" using
Expand|Select|Wrap|Line Numbers
  1. Request.Form.GetValues("cbBrand");
and then store that value into an array.
Jul 26 '10 #5
weaknessforcats
9,208 Expert Mod 8TB
If you use a vector your code would be:

Expand|Select|Wrap|Line Numbers
  1. vector<String> v;
  2.  
  3. v.push_back(Request.Form.GetValues("cbBrand")); 

vector implements an array. In this case v is an array of String.

You might find this works for you.
Jul 26 '10 #6
Joseph Martell
198 Expert 128KB
Are you writing this in C/C++ or C#? Your file name extension ".cs" would seem to indicate you intended this to be posted in the C# forum.

IF you are writing this in C#, then you probably need to use a collection of some kind (like List). It will give you all the same functionality of an array plus the convenience of not needing to know the size before hand.
Jul 26 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Alexander Ross | last post by:
I know your first reaction will be "WHY?!?!" But can it be done? Can I store a php array in a postgresql database? -- Alexander Ross alexross@bleen.net
1
by: Hale | last post by:
Hi, I'm having a problem storing an array inside of a hash. I'm bringing in a hash via a reference and I want to assign a value to it. This is what I'm doing: push (@{$$node->{ELEMENTS}},...
3
by: Kay | last post by:
ABC ASF DFS ASS ABC <--- Duplicate JJK I want to store above char in an arry, but I'm not sure I'm right or not anyone can guide me or give me some suggestions, Thx?
26
by: Radith | last post by:
Hi All, I have got this task which I cant get my head around: It asks how I would store information: I just want to get an opinion from the group: So here's the question: " You have been...
0
by: Opa | last post by:
Hi, I am using the CF.NET which doesn't support serialization, so I am trying to do it myself. I have a class array which I am trying to store to a file using a binary writer. Is there a...
0
by: Visual Systems AB \(Martin Arvidsson\) | last post by:
Hi! I want to display some subjectlines, read from outlook into a checkedListBox. But with every item displayed in that list box, i want to store an EntryID and an e-mail adress so when i go...
3
by: Brad | last post by:
I am storing an array which contains about a dozen chracter items to a Session variable. Later, I need to use this array so I am doing the following: Dim eventTypes As String() =...
3
by: Nayan Mansinha | last post by:
Hi All How can I store an array of objects in my C# Application.Settings? I have CMyObject class for which an array is created: CMyObject arr = new CMyObject; arr = new CMyObject();...
1
by: Nikolay Petrov | last post by:
What is the best method to store an Integer array in MS Access DB example class testClass public ID1 as integer public ID2 as integer public Data() as Integer End Class
3
by: aliz2000 | last post by:
hi, I have a program which creates a list of x and y values from a calculation. e.g sx sy 10 20 15 67 20 70 Iam trying to store these into an array each time it...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...
0
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...

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.