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

  • SEARCH
  • Home
  • 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 8606889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:12:28+00:00 2026-06-12T03:12:28+00:00

ive got for example 25 panels that are formed like a grid (5 rows,

  • 0

ive got for example 25 panels that are formed like a grid (5 rows, 5 columns),
if i click at one of those i want to get e.g. the panel above too.
at first i named the panels like their positions e.g. PanelX1Y1, PanelX1Y2 …
then i took the coords out of the name and created the new coords…
and after i got the new name, i used a foreach loop to go through all the items and get that one with the right name.

ive already tried it with the winforms positions so i took the positions of the clicked one addet e.g. 25 pixels and lopped through all the items in form and checked them via their location.

But i dont want to looped through all the items …
how can i get the item if i know its name whitout to loop through all items and check for their names..

can i use this:
this.Controls[“name”];

okay my grid:
p11 p12 p13
p21 p22 p23
p31 p32 p33

if i click on p31 i want to change something at p31 and p21 so i need the object p21

  • 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-12T03:12:29+00:00Added an answer on June 12, 2026 at 3:12 am

    To directly answer you question, you can use the Find() method of the ControlCollection class. e.g.:

    myForm.Controls.Find("panelX1Y2")
    

    To suggest a better method, don’t use strings for something like this. It is hackish and sloppy.

    Instead, initialize your panels in a 2D array and use the array indices to find the right panel.

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

Sidebar

Related Questions

for example ive got a div like: <div class=y1> <img src=i/o.png /> </div> and
got a problem with dets:to_ets/2 Could somebody point me to an example online? Ive
I've got coordinates of one pixel of my image (for example int i,j; ),
Ive got a table: UserA UserB UserBB UserAA for example: 1 2 2 1
I've got a LAMP dev server at something like dev.example.com. Eventually this will be
I've got a custom control that inherits from Panel . At Load-time, I want
Ive got table: UserA, UserB, numberOfConnections I would like to write query which returns
Ive got table with null values in it. I would like to copy this
Ive got an app that allows users to listen to music. Each artist has
Ive got a problem. I send a pointer in function that replace 3 last

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.