473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Adding Controls At Run-Time [Win #C]

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
2 1148
> 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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new...
2
by: Patrick | last post by:
Hello I have a Datalist, that I fill with the PopulateList() method. This method selects all Items from Database and binds the Dataset to the DataLilst. Now, when clicking Edit, in the...
5
by: Jeremy Ames | last post by:
I have run into a major road block with my page development projects. I am trying to add a literal control to my asp.net page and I got an error stating that the control could not be added because...
2
by: D Sheldon | last post by:
I am creating a server control that adds web controls (i.e. textboxes, etc) to a form. I use HtmlTable to build the table and insert the controls. Now I want to add validators to the textbox. Here...
0
by: Luis Esteban Valencia | last post by:
Hello I wrote a program with code behind in C# to add row into table dynamically and the program worked very well in .Net Framework 1.1. When I run this program in .Net Framework 2.0 beta...
3
by: Ankit Aneja | last post by:
I have a strange situation and I have no idea how to solve this. Its a Recruitment Search Page,in the Admin Page, for every button click event the Admin Person has to create a checkbox on the users...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
8
by: Jason | last post by:
Hello, I am trying to utilitze the AJAX Control toolkit in my asp.net project. I have added a reference to AjaxControlToolkit.dll, and in my page, added these lines of code: ...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
6
by: alun65 | last post by:
I'm having trouble programmatically adding a user control and then setting some of it's server controls. I add the user control to the code behind and add it to a placeholder: protected void...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.