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

Adding Controls At Run-Time [Win #C]

P: n/a
Hi everyone,

I have built a user control "keyboard" and I am trying to figure a way to
add this control at run-time. I have also tried creating a Inherited user
control, which I am able to add this to my form at run-time, but does not
have the functionality of passing the data back to the main form, ie: data
from the keys being pressed (delegate) or being able to close this control
and getting rid of it after it is no longer needed.

my Code that I've been working with is as follows:

HOST.I_Ctrl_KeyBoard myKeyBoard= new HOST.I_Ctrl_KeyBoard();
myKeyBoard.Location = new System.Drawing.Point(275, 305);

myKeyBoard.Parent = this;
myKeyBoard.BringToFront();
myKeyBoard.Show();

Does anyone have a sample syntax or suggestions, tips, links, etc. Anything
is appreciated.

Thanks,

MikeY
May 18 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> HOST.I_Ctrl_KeyBoard myKeyBoard= new HOST.I_Ctrl_KeyBoard();
myKeyBoard.Location = new System.Drawing.Point(275, 305);

myKeyBoard.Parent = this;
myKeyBoard.BringToFront();
myKeyBoard.Show();


If this is to be a control on the form you need:
this.Controls.Add ( myKeyBoard) ;

May 18 '06 #2

P: n/a
You need to add the Control to the Controls Collection of whatever Control
you want to host it in, even if that is just the Form itself.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

The man who questions opinions is wise.
The man who quarrels with facts is a fool.

"MikeY" <mi*******@yaho.com> wrote in message
news:36*******************@news20.bellglobal.com.. .
Hi everyone,

I have built a user control "keyboard" and I am trying to figure a way to
add this control at run-time. I have also tried creating a Inherited user
control, which I am able to add this to my form at run-time, but does not
have the functionality of passing the data back to the main form, ie: data
from the keys being pressed (delegate) or being able to close this control
and getting rid of it after it is no longer needed.

my Code that I've been working with is as follows:

HOST.I_Ctrl_KeyBoard myKeyBoard= new HOST.I_Ctrl_KeyBoard();
myKeyBoard.Location = new System.Drawing.Point(275, 305);

myKeyBoard.Parent = this;
myKeyBoard.BringToFront();
myKeyBoard.Show();

Does anyone have a sample syntax or suggestions, tips, links, etc.
Anything is appreciated.

Thanks,

MikeY

May 18 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.