Results 1 to 4 of 4

Thread: How Do I Create A Control Array Like I Did In VB6

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    How Do I Create A Control Array Like I Did In VB6

    I want to create a control array but I would like to do so by drawing them in design mode. I know how to create control array with code but then I have to manually type the x,y for each control. I have a program with 50+ controls.

    Any ideas?

  2. #2
    Addicted Member
    Join Date
    May 2000
    Location
    Wellington NZ
    Posts
    153

    Re: How Do I Create A Control Array Like I Did In VB6

    You cant create a control array during design time, maybe you could group all the controls together on one panel and index them like so...

    int i = 0;
    foreach(Control c in panel1.Controls)
    {
    c.Text = i.ToString();
    i++;
    }

    or even like this...

    panel1.Controls[0].Text = string.Empty;
    You dont need eyes to see, you need vision.

  3. #3
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Re: How Do I Create A Control Array Like I Did In VB6

    You can just make an array of controls.

    textbox[] boxes = new textbox[5];
    ...
    I don't live here any more.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    121

    Re: How Do I Create A Control Array Like I Did In VB6

    yeah i knew that .... i just didnt want to set the x, y for 50+ controls

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width