473,386 Members | 1,883 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,386 software developers and data experts.

short question1

Hi...
I have an array of elements that has dinamic size,
sometimes has 5 elements, sometimes 3 etc...
I would like to create a WebForm with as <input type=text>
as elements i have in this array
What is the way to make this, cause if i use a loop i dont
know how i can instanciate the class with another name...
For instance

for (int i=0;i<array.lenght;i++)
{
TextBox mytextbox=new TextBox();
}
the problem with this is that: mytextbox is instanciate so
many times and i dont know how i can give another name to
the control in each round in the loop.
I suppose that its not the correct way, make this.. no?
Thanks in advance...
Josema.

Nov 15 '05 #1
1 1693
On Wed, 12 Nov 2003 02:58:41 -0800, josema <je****************@ocu.org>
wrote:
Hi...
I have an array of elements that has dinamic size,
sometimes has 5 elements, sometimes 3 etc...
I would like to create a WebForm with as <input type=text>
as elements i have in this array
What is the way to make this, cause if i use a loop i dont
know how i can instanciate the class with another name...
For instance

for (int i=0;i<array.lenght;i++)
{
TextBox mytextbox=new TextBox();
}
the problem with this is that: mytextbox is instanciate so
many times and i dont know how i can give another name to
the control in each round in the loop.
I suppose that its not the correct way, make this.. no?
Thanks in advance...
Josema.


You don't have to worry about what name each texbox have as they don't
care. But you do need to keep track of the references to them. In your
loop, you will create a new TextBox but it will disappear instantly since
you don't store the reference for it anywhere.

I'm not sure what you are trying to accomplish, but a way to create as
many textboxes as there are items in the array list you can do something
like

ArrayList textboxList = new ArrayList();
for( int i = 0; i < array.Length; i++ )
{
TextBox namemdoesnotmatter = new TextBox();
textboxList.Add(namedoesnotmatter);
}

textboxList now holds all TextBox references for later use.

--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Nov 15 '05 #2

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

Similar topics

7
by: varois83 | last post by:
Hi I am fairly new to PHP/mysql and was reading an online tutorial and learned that my short tags weren't enabled. At this time I have no need for them, my setup apache/mysql/php runs on my PC...
10
by: Niels Dekker (no reply address) | last post by:
Is it possible for a standard compliant C++ compiler to have ( sizeof(short) < sizeof(int) ) and ( sizeof(short) == sizeof((short)0 + (short)0) ) ? Regards, Niels Dekker...
99
by: Glen Herrmannsfeldt | last post by:
I was compiling a program written by someone else about six years ago, and widely distributed at the time. It also includes makefiles for many different systems, so I know it has been compiled...
34
by: Andy | last post by:
Hi, Are 1 through 4 defined behaviors in C? unsigned short i; unsigned long li; /* 32-bit wide */ 1. i = 65535 + 3; 2. i = 1 - 3; 3. li = (unsigned long)0xFFFFFFFF + 3; 4. li = 1...
18
by: a | last post by:
short s; long l; s= -2; l= -3; printf("% _ %_",s, l); What characters should be filled out in the formatted string for output? Thanx
8
by: NilsNilsson | last post by:
I wrote this: short s1 = 0; short s2 = 1; short s3 = s1 + s2; And gor this compile error message: Cannot implicitly convert type 'int' to 'short' What is wrong here?
8
by: Ken Dopierala Jr. | last post by:
Hi, I'm reading the header file of a PCX image and I need to convert 2 bytes to a short. How would I go about doing this? I know that they are bytes 8 & 9 in my byte array. I'm not sure how to...
4
by: slougheed | last post by:
I encountered a problem after we had converted our declarations of 'unsigned short int' to uint16_t. In one instance, whoever did the conversion failed to delete the 'short' keyword so we had a...
10
by: nyhetsgrupper | last post by:
The following code result in the following compilation error: Error 1 Cannot implicitly convert type 'int' to 'short'. An explicit conversion exists (are you missing a cast?) short a = 1; short...
3
by: mathieu | last post by:
Could someone please tell me what is wrong with the following -ugly- piece of c++ code. Why when I explicititely set the template parameter my gcc compiler start getting confused: bla.cxx: In...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.