5 Replies - 12023 Views - Last Post: 03 March 2008 - 02:19 PM Rate Topic: -----

#1 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Changing backcolor of a label.

Posted 03 March 2008 - 12:31 PM

Here's my code:
if (this.label1.Text == numllamados[1])
			{
				this.label1.BackColor = Color.Blue;
			}



Is there a way I can make the if statement apply from label1---->label48? I don't want to make 48 ifs...

Maybe something like:

if (this.label1-48.Text == numllamados[1])
{
this.label1.BackColor = Color.Blue;
}


Is This A Good Question/Topic? 0
  • +

Replies To: Changing backcolor of a label.

#2 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Changing backcolor of a label.

Posted 03 March 2008 - 12:43 PM

View Postpapuccino1, on 3 Mar, 2008 - 12:31 PM, said:

Here's my code:
if (this.label1.Text == numllamados[1])
			{
				this.label1.BackColor = Color.Blue;
			}



Is there a way I can make the if statement apply from label1---->label48? I don't want to make 48 ifs...

Maybe something like:

if (this.label1-48.Text == numllamados[1])
{
this.label1.BackColor = Color.Blue;
}


Hello???? Is anyone here???????
Was This Post Helpful? 0
  • +
  • -

#3 Jayman  Icon User is offline

  • Student of Life
  • member icon

Reputation: 418
  • View blog
  • Posts: 9,532
  • Joined: 26-December 05

Re: Changing backcolor of a label.

Posted 03 March 2008 - 01:44 PM

Not in a single IF statement. You will need to loop through all the label controls setting each one individually.
Was This Post Helpful? 0
  • +
  • -

#4 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Changing backcolor of a label.

Posted 03 March 2008 - 01:55 PM

View Postjayman9, on 3 Mar, 2008 - 01:44 PM, said:

Not in a single IF statement. You will need to loop through all the label controls setting each one individually.



Thank you for the answer :)

I was afraid that was the case, so I went ahead and made the program.

Is it kosher if I post the executable here for you guys to give input and advice on improvments? I fell really proud because this is in effect, my FIRST ever game.

First of many more hopefully. :pirate:
Was This Post Helpful? 0
  • +
  • -

#5 zakary  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 27
  • View blog
  • Posts: 427
  • Joined: 15-February 05

Re: Changing backcolor of a label.

Posted 03 March 2008 - 02:13 PM

I dont think you can post exe here but you can post your code and we can compile it our selfs.
Was This Post Helpful? 0
  • +
  • -

#6 papuccino1  Icon User is offline

  • His name was Robert Paulson.
  • member icon

Reputation: 63
  • View blog
  • Posts: 1,121
  • Joined: 02-March 08

Re: Changing backcolor of a label.

Posted 03 March 2008 - 02:19 PM

Edit: Thank you all for the help. Someone delete this topic now :D

This post has been edited by papuccino1: 03 March 2008 - 04:05 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1