Computer Science Canada Adding Controls At Run-Time |
Author: | GlobeTrotter [ Wed Nov 23, 2005 6:37 pm ] | ||
Post subject: | Adding Controls At Run-Time | ||
I want to be able to click a button that will in turn add more instances of a frame on each click. On my form, I have one frame already, index number 0. This is the code for the cmd_click procedure.
It seems to work if I press it once, and it creates another one underneath it. However, when I try and press it again, it does not create a third instance. Any ideas why? I'm stumped. |
Author: | Brightguy [ Wed Nov 23, 2005 9:47 pm ] |
Post subject: | Re: Adding Controls At Run-Time |
Actually you're just creating them all in the same spot. You're setting the new frame's Top to be fraTextNum(fraTextNum.Count - 1).Top + fraTextNum(fraTextNum.Count - 1).Height + 30, but fraTextNum(fraTextNum.Count - 1).Top was just set to the first frame's Top. You probably want to add on the Top of the previous frame created instead, that is, fraTextNum(fraTextNum.Count - 2).Top |
Author: | GlobeTrotter [ Wed Nov 23, 2005 11:21 pm ] |
Post subject: | |
Thanks, that was stupid. Now, what if I want to do the exact same thing for, say, a textbox but have the new instance of the textbox inside the frame I just created? When I try and do it, the textbox I create is stuck inside the original frame. I can't really see any properties I can change at run-time to select the frame it should be in, could you help please? |
Author: | Brightguy [ Fri Nov 25, 2005 3:54 pm ] | ||
Post subject: | Re: Adding Controls At Run-Time | ||
|