Can't you create a user control?

On Wed, Jan 26, 2011 at 8:01 AM, OhGreatOne <[email protected]> wrote:

> Windows form application.
> I've never used the Panel control.
>
> Let's say I have three Panel controls on a form, and all three will
> have an identical set of controls, say, three buttons and a textbox
> each. Is there a way to refer to the panels as, say, a collection and
> the controls within as components of the collection so in my program
> logic I don't have to explicitly code for each panel and each control
> within. For example, I don't want to have to code for button1 in panel
> 1, and have the same code for button3 in panel2, and so on. (Using my
> example, I'd have to have nine sets of code because each button has a
> unique name.) I'd rather just have common code that I can use, like
> panel[x].button[y], where I'd supply the index to the panel I'm in
> question and the control within that panel.
>
> Is it perhaps something that can be done at runtime?
> Is there a better alternative?

Reply via email to