By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,246 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

What is the best way of adding various user Controls? [Win #C]

P: n/a
Hi everyone,

I'm trying to figure out, on my windows form, of what is the best way to add
various custom controls at various times during run-time. The problem is
that they will need to be in the same spot as each other, depending on what
is being called at that particular time by the user. I have been trying to
use Inherited user controls, but I am not able, and/or don't know how to
retrieve the data from my Inherited user control. If the controls were
actually pre-contained then I use regular delagates, but with Inherited
controls I am unsure of the options. I also believe that I cannot add my
regular built custom controls at runtime and pass data from my delagates.

So if there are any suggestions, links, sample syntax's would be
appreciated.

MikeY
May 19 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,
Not sure what you mean with user controls (I've only seen this term in web
escenarios)
Anyway, all you have to do to add a control is create it, set the properties
(location, text, etc) and add it to the Controls collection of the correct
container (TabPage, Form)

Accesing the especific properties can be achieved by casting:

MyControl c = (MyControl) this.Controls[0];
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"MikeY" <mi*******@yaho.com> wrote in message
news:rm*******************@news20.bellglobal.com.. .
Hi everyone,

I'm trying to figure out, on my windows form, of what is the best way to
add various custom controls at various times during run-time. The problem
is that they will need to be in the same spot as each other, depending on
what is being called at that particular time by the user. I have been
trying to use Inherited user controls, but I am not able, and/or don't
know how to retrieve the data from my Inherited user control. If the
controls were actually pre-contained then I use regular delagates, but
with Inherited controls I am unsure of the options. I also believe that I
cannot add my regular built custom controls at runtime and pass data from
my delagates.

So if there are any suggestions, links, sample syntax's would be
appreciated.

MikeY

May 19 '06 #2

P: n/a
MikeY,
Generally what I do is use a Tab Control where the entire Tab surface is
covered by the requisite usercontrol, or if you have a smaller area you can
put the usercontrol into a Panel or GroupBox.

Hope that helps.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MikeY" wrote:
Hi everyone,

I'm trying to figure out, on my windows form, of what is the best way to add
various custom controls at various times during run-time. The problem is
that they will need to be in the same spot as each other, depending on what
is being called at that particular time by the user. I have been trying to
use Inherited user controls, but I am not able, and/or don't know how to
retrieve the data from my Inherited user control. If the controls were
actually pre-contained then I use regular delagates, but with Inherited
controls I am unsure of the options. I also believe that I cannot add my
regular built custom controls at runtime and pass data from my delagates.

So if there are any suggestions, links, sample syntax's would be
appreciated.

MikeY

May 19 '06 #3

P: n/a
Actually that really is a good solution Peter. In fact I'm going to give
that one a go.

Much appreciated & thanks everyone.

MikeY

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:10**********************************@microsof t.com...
MikeY,
Generally what I do is use a Tab Control where the entire Tab surface is
covered by the requisite usercontrol, or if you have a smaller area you
can
put the usercontrol into a Panel or GroupBox.

Hope that helps.
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"MikeY" wrote:
Hi everyone,

I'm trying to figure out, on my windows form, of what is the best way to
add
various custom controls at various times during run-time. The problem is
that they will need to be in the same spot as each other, depending on
what
is being called at that particular time by the user. I have been trying
to
use Inherited user controls, but I am not able, and/or don't know how to
retrieve the data from my Inherited user control. If the controls were
actually pre-contained then I use regular delagates, but with Inherited
controls I am unsure of the options. I also believe that I cannot add my
regular built custom controls at runtime and pass data from my delagates.

So if there are any suggestions, links, sample syntax's would be
appreciated.

MikeY

May 19 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.