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

Concatenating Object instance name in loop???

Isz
I can do this easily enough in actionscript, but I would like to do it also
in C#. I have 10 Image controls on the .aspx page. I want to create a
loop that makes the first 'n' number of Images' control prroperty visible =
true.

My Image controls are named: Image1, Image2, Image3... etc.

In actionscript I would do something like this...

this["image" + n].visible = true;

How can you concatenate an object instance name?

Isz
Nov 16 '05 #1
3 3121
PictureBox[] pba = new PictureBox[2];

pba[0] = new PictureBox();

pba[1] = new PictureBox();

pba[0].Visible = false;

....
--
William Stacey, MVP

"Isz" <so*******@nowhere.net> wrote in message
news:w4********************@giganews.com...
I can do this easily enough in actionscript, but I would like to do it also in C#. I have 10 Image controls on the .aspx page. I want to create a
loop that makes the first 'n' number of Images' control prroperty visible = true.

My Image controls are named: Image1, Image2, Image3... etc.

In actionscript I would do something like this...

this["image" + n].visible = true;

How can you concatenate an object instance name?

Isz


Nov 16 '05 #2
Isz
"William Stacey [MVP]" <st***********@mvps.org> wrote in
news:OK*************@tk2msftngp13.phx.gbl:
PictureBox[] pba = new PictureBox[2];

pba[0] = new PictureBox();

pba[1] = new PictureBox();

pba[0].Visible = false;

...


Most Excellent! This is just what i needed to get what i want
accomplished... here is the code I actually ended up using (I was
developing for a webform)...

while(reader2.Read())
{
ObjectPics thisPics = new ObjectPics();
thisPics.pictureID = reader2.GetInt32(0);
thisPics.pictureName = reader2.GetString(1);
thisPics.pictureLocation = reader2.GetString(2);
thisPics.itemID = reader2.GetInt32(3);
picSetArray.Add(thisPics);

imageArray[count] = new System.Web.UI.WebControls.Image();
imageArray[count].Visible = true;
imageArray[count].ImageUrl = thisPics.pictureLocation +
thisPics.pictureName;
Page.Controls.Add(imageArray[count]);
count += 1;
}
Nov 16 '05 #3
Cool. glad that go you going. Cheers!

--
William Stacey, MVP

"Isz" <so*******@nowhere.net> wrote in message
news:MI********************@giganews.com...
"William Stacey [MVP]" <st***********@mvps.org> wrote in
news:OK*************@tk2msftngp13.phx.gbl:
PictureBox[] pba = new PictureBox[2];

pba[0] = new PictureBox();

pba[1] = new PictureBox();

pba[0].Visible = false;

...


Most Excellent! This is just what i needed to get what i want
accomplished... here is the code I actually ended up using (I was
developing for a webform)...

while(reader2.Read())
{
ObjectPics thisPics = new ObjectPics();
thisPics.pictureID = reader2.GetInt32(0);
thisPics.pictureName = reader2.GetString(1);
thisPics.pictureLocation = reader2.GetString(2);
thisPics.itemID = reader2.GetInt32(3);
picSetArray.Add(thisPics);

imageArray[count] = new System.Web.UI.WebControls.Image();
imageArray[count].Visible = true;
imageArray[count].ImageUrl = thisPics.pictureLocation +
thisPics.pictureName;
Page.Controls.Add(imageArray[count]);
count += 1;
}


Nov 16 '05 #4

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

Similar topics

1
by: dont bother | last post by:
Hey, I have these attributes: index which is a numerical value value vector which is a numerical float value and I want to concatenate like this:
14
by: foodic | last post by:
i am fresher to C++ programming, and I just want to learn Concatenating Calls, I have written a program, class SetMe { public: void setX(int x) {_x = x;} void setY(int y) {_y = y;} void...
2
by: Aaron | last post by:
I have a data sructure setup and I populate it in a loop like so: y=0 while X: DS.name = "ASDF" DS.ID = 1234 list = DS; y = y + 1
16
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a...
6
by: Trevor Hartman | last post by:
Hi, I need to refer to my objects dynamically. I have a 7 table cells (sunCell, monCell, tueCell....). I am looping through some data, checking its date and adding it to the correct cell. I...
4
by: Elena | last post by:
Hi, I am filling in a combobox. I would like to concatenate two fields into the data combo box and display "last name, first name" I tried to displaymember = "employee_last_name" & ", " &...
4
by: jm.suresh | last post by:
Hi, Is there any standard text format for storing data of object oriented nature. The text file should be readable. That is, Is there any better way than having to write out a file like this...
3
by: crater | last post by:
I'm using PHP 5.2. I've created classes to embody HTML elements for a particular project I'm currently working on. All setter methods in the classes return $this so that I can string the...
6
by: Bugs | last post by:
Does anyone have any recommendations on the best way to create multiple instances of the same class when the final number of instances is unknown? For example, I have a class and based on some...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.