Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:52:39+00:00 2026-06-03T15:52:39+00:00

I have a method making a (new) lblArray of 35 labels, but the labels

  • 0

I have a method making a (new) lblArray of 35 labels, but the labels on the array need to reset at the push of a button.

So i’ve put the same method in the button1_onclick, but then it just makes a new array underneath the previous one..

Could you guys push me in the right direction please?

Thanks in advance!
David

Some code:

public void CreateLableArray() {      
      LblArray = new Label[5, 7];
      int xpos = 0;
      int ypos = 0;

      for (int x= 0; x< 5; x++) {
        for (int y= 0; y< 7; y++) {
          LblArray[x, y] = new Label();
          LblArray[x, y].Left = xpos;
          LblArray[x, y].Top = ypos;
          LblArray[x, y].Width = 50;
          LblArray[x, y].Height = 50;
          LblArray[x, y].Text = String.Empty;         
          LblArray[x, y].Click += lblArray_Click;
          LblArray[x, y].BackColor = Color.Aqua;
          LblArray[x, y].BorderStyle = BorderStyle.FixedSingle;

          pnlPanel.Controls.Add(LblArray[x, y]);

          xpos += LblArray[x, y].Width;
        }
        ypos += LblArray[x, 0].Width;
        xpos = 0;
      }
    }/*CreateLableArray*/

private void EmptyLabels() {
      for (int x = 0; x < 5; x++) {
        for (int y = 0; y < 7; y++) {
          LblArray[x, y].BackColor = Color.Aqua;
        }
      }
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T15:52:40+00:00Added an answer on June 3, 2026 at 3:52 pm

    It sounds like all you need to change for the labels is their color, so rather than making new labels and going through all of the work of removing the old ones and adding the new ones it will be much easier to just change the color of the existing labels. Since you found out how to change it to another color in the first place I assume you’re capable of doing this, yes? If not, just as so and we can help you with the relevant code snippet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple jigsaw puzzle i'm making. I have a method that is
I have method in a class that I need to make sure is only
I have this method that changes an larger image source on click. I need
I am new to EJB. I have a requirement of calling a method of
I'm making a Rails app where I have a method: def updateAttributes_post if logged_in?
I am using the new ReplicaSetConnection method for making a connection to my mongodb
Is there a best practice for making private methods in classes static? I have
I've got some 3rd party beans that have method signatures that fit quite well
I create small application which is media player. I have method where I have
I have a method that accepts an IEnumerable-decimals and performance various math functions. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.