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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:01:19+00:00 2026-05-22T18:01:19+00:00

i got this GetEnumerator problem.. here’s my situation Panel eachPanel = new Panel(); eachPanel.Size

  • 0

i got this GetEnumerator problem.. here’s my situation

        Panel eachPanel = new Panel();
        eachPanel.Size = new Size(pnlProcessCon.Width - 27, 24);
        eachPanel.Location = new Point(5, startPoint);
        eachPanel.BackColor = (defaultColor == alterColor[0]) ? alterColor[1] : alterColor[0];            

        TextBox txtProcess = new TextBox();
        txtProcess.Size = new Size(50, 20);
        txtProcess.Location = new Point(2,2);
        txtProcess.TextAlign = HorizontalAlignment.Center;
        txtProcess.Text = "P" + Convert.ToString(startProcess);

        TextBox txtBurstTime = new TextBox();
        txtBurstTime.Size = new Size(50, 20);
        txtBurstTime.Location = new Point(txtProcess.Right + 70, 2);
        txtBurstTime.TextAlign = HorizontalAlignment.Center;

        TextBox txtPriority = new TextBox();
        txtPriority.Size = new Size(50, 20);
        txtPriority.Location = new Point(txtBurstTime.Right + 70, 2);
        txtPriority.TextAlign = HorizontalAlignment.Center;

        eachPanel.Controls.Add(txtProcess);
        eachPanel.Controls.Add(txtBurstTime);
        eachPanel.Controls.Add(txtPriority);

        pnlProcessCon.Controls.Add(eachPanel);

but when i call each of their text and add to dictionary, i got this error..

Error   1   foreach statement cannot operate on variables of type 'System.Windows.Forms.Panel' because 'System.Windows.Forms.Panel' does not contain a public definition for 'GetEnumerator'    C:\Users\vrynxzent@yahoo.com\Documents\Visual Studio 2008\Projects\Scheduler\Scheduler\Form1.cs 68  13  Scheduler

and got my error here..

foreach (var each in pnlProcessCon)
        {
            String[] temp = new String[3];
            foreach (var process in each)
            {
                temp = process.Text;                    
            }

        }
  • 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-05-22T18:01:20+00:00Added an answer on May 22, 2026 at 6:01 pm

    There are a few issues there.

    First, you should enumerate the Controls collections. Second, you will have to cast each control to TextBox before you can retrieve the text. Third, you declared temp as an array, so you can’t directly assign a string to it. Fourth (as Henk Holterman pointed out), you should use actual types and not var in the foreach loops.

    I’m going to take a stab at working code here. Feel free to adjust for your own needs.

    TextBox txtProcess = new TextBox();
    txtProcess.Name = "Process";
    //configure other textboxes, add to panels, etc.
    
    foreach (Panel each in pnlProcessCon.Controls)
    {
        String[] temp = new String[3];
        foreach (Control control in each.Controls)
        {
            if(control.Name == "Process")
            {
                temp[0] = ((TextBox)control).Text;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

got this situation. Reports habtm users. So Im trying to paginate just the Reports
Got this here query: EXPLAIN SELECT persons.id AS id, ppm.first FROM myschema.persons INNER JOIN
I got this error message .. what is the problem ? Traceback (most recent
I got this far... here is my code: - (void)applicationDidFinishLaunching:(UIApplication *)application { // create
Got this really stupid problem: Can find the proper name for the android folder
I got this small problem but I find it hard to explain so bear
i got this error when i publish website in remote location , its accrues
Got this code from here http://www.irunmywebsite.com/raphael/drawtool2.php . Runs great in IE when I tested
I got this problem. I don't know if I'm just too tired or if
I got this error today when trying to open a Visual Studio 2008 project

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.