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 9221575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:36:32+00:00 2026-06-18T03:36:32+00:00

I have a TableLayoutPanel with a grid of PictureBox controls within it. I’m trying

  • 0

I have a TableLayoutPanel with a grid of PictureBox controls within it. I’m trying to find a shortcut way to change them all to Label controls instead of manually deleting each one and placing new controls in each cell.

I thought I could go into the designer code and find/replace PictureBox with Label, but now I get an

“Object does not match target type”

error in Visual Studio’s error list. I can’t view the designer page now either. Is this not allowed? If it is allowed, what’s the right way to do it?

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

    If you take a closer look at the generated code:

    label1:

    this.label1 = new System.Windows.Forms.Label();
    // 
    // label1
    // 
    this.label1.AutoSize = true;
    this.label1.Location = new System.Drawing.Point(134, 163);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(35, 13);
    this.label1.TabIndex = 1;
    this.label1.Text = "label1";
    

    pictureBox1:

    this.pictureBox1 = new System.Windows.Forms.PictureBox();
    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
    // 
    // pictureBox1
    // 
    this.pictureBox1.Location = new System.Drawing.Point(97, 75);
    this.pictureBox1.Name = "pictureBox1";
    this.pictureBox1.Size = new System.Drawing.Size(100, 50);
    this.pictureBox1.TabIndex = 0;
    this.pictureBox1.TabStop = false;
    

    My guess is that the

    ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
    

    is changed by you into something like:

    ((System.ComponentModel.ISupportInitialize)(this.label1)).BeginInit();
    

    which doesn’t work, and results in designer issues. Object does not match target type.

    so, apply the changes you already did, remove the lines like:

    ((System.ComponentModel.ISupportInitialize)(this.label1)).BeginInit();
    ((System.ComponentModel.ISupportInitialize)(this.label1)).EndInit();
    

    and I think you’re good to go.

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

Sidebar

Related Questions

happy holidays! i have a tablelayoutpanel (10x10). within each cell i have a picturebox
I have a series of nested TableLayoutPanel controls which each of them contains lots
Hi I have this TablelayoutPanel setup currently in my program to create a grid
I am using a TableLayoutPanel to contain controls that I would like to have
I generate controls for a TableLayoutPanel dynamically. I have a delete button in each
Stack-O, I have a TableLayoutPanel with 50 rows and 6 columns. That's all well
I have added controls dynamically on runtime inside the rows of a tableLayoutpanel ,
I have spent all day trying to solve this with no satisfying results. I
I have a programmatically created TableLayoutPanel. It works fine but I couldn't find something:
I have a TableLayoutPanel and every time I put a label into one of

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.