View Single Post
Old Apr 15th, 2008, 8:05 AM   #1
beni_dude
Newbie
 
beni_dude's Avatar
 
Join Date: Apr 2008
Posts: 19
Rep Power: 0 beni_dude is on a distinguished road
Question cration of a new control, problem with adding new controls

Hello,
I have a problem when I try to add a new control to the panel control, I'm sure its a newbie problem but still I can't go around it!

What I'm trying to do is to create a new control which well be only one panel control and in it twelve text box (array of text box).

I'm also adding the code

Quote:
public partial class MonthPick : Control
{
public const int arrSize = 12;

public MonthPick()
{
InitializeComponent();

TextBox[] boxArr = new TextBox[arrSize];
initBoxArr(boxArr, arrSize);

//the problem is with the next line
panel1.Controls.Add = boxArr;
}

private void initBoxArr(TextBox[] boxArr, int arrSize)
{
for (int i = 0; i < arrSize; i++)
{
boxArr[i] = new TextBox();
}
}

protected override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
}


}
I just don't know how to add the array of text box's

Thanks
beni_dude is offline   Reply With Quote