473,513 Members | 2,406 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create Dynamic Control Arrays

I have created a simple user control. On the parent form i would like to
display n instances of my usercontrol based on how many the user wants. How
would you do this in vb.net or c#.net. If this were an asp.net application i
think i could use something such as the repeater control.

Thanks.
--
Just another lost developer.....
Jul 21 '05 #1
2 1645
I am assuming this is a win form app. To add a control dynamically, just
instantiate the control type, ie MyControl ctlr = new MyControl, set the
properties you need, ie
ctrl.Location = new Point(x,y); etc. then add the control to the form's
controls collection, frm.controls.Add(ctrl); (or this.control if executing
within the form)

does this help?

Tom Wisnowski
MCP MCAD

"**** KiteOregon ****" wrote:
I have created a simple user control. On the parent form i would like to
display n instances of my usercontrol based on how many the user wants. How
would you do this in vb.net or c#.net. If this were an asp.net application i
think i could use something such as the repeater control.

Thanks.
--
Just another lost developer.....

Jul 21 '05 #2
int currentY = 10; // starting y location
for (int i = 0; i < numControls; i++)
{
Control c = new Control();
c.Location = new Point(x, currentY);
// other init
this.Controls.Add(c);

currentY += 20;
}
"**** KiteOregon ****" wrote:
I have created a simple user control. On the parent form i would like to
display n instances of my usercontrol based on how many the user wants. How
would you do this in vb.net or c#.net. If this were an asp.net application i
think i could use something such as the repeater control.

Thanks.
--
Just another lost developer.....

Jul 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
345
by: **** KiteOregon **** | last post by:
I have created a simple user control. On the parent form i would like to display n instances of my usercontrol based on how many the user wants. How would you do this in vb.net or c#.net. If...
4
2453
by: learnfpga | last post by:
Here is a little code I wrote to add the numbers input by the user.....I was wondering if its possible to have the same functionality without using dynamic arrays.....just curious..... ...
23
7367
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
4
11194
by: singleb | last post by:
I've tryed to something lik this and got "Object reference not set to an instance of an object." Dim myarr(,) As String myarr(0, 0) = "aaaa" myarr(0, 1) = "bbbb" myarr(1, 0) = "cccc" myarr(1,...
5
3654
by: plsHelpMe | last post by:
How to create dynamic javascript arrays using dojo toolkits Hello frens, I am in a big trouble. My objective is: I am having some categories shown by differnent radio buttons, on the click of...
1
4639
by: MaryamSh | last post by:
Hi, I am creating a Dynamic Search in my application. I create a user control and in Page_load event I create a dynamic dropdownlist and 2 dynamic button (Add,Remove) By pressing Add button...
0
3469
by: MaryamSh | last post by:
Create Dynamic Dropdownlist Controls and related event -------------------------------------------------------------------------------- Hi, I am creating a Dynamic Search in my application. I...
2
2235
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I am using vb.net 2005 and the following code trying to create varible at runtime: For n=1 to 4 dim v+n.tostring(n) as double Next n the resone behaind using the previous...
4
5412
by: Sunny | last post by:
Hi, Is there a way in javascript to create Dynamic arrays or arrays on fly. Something Like: var "ptsgN"+sd = new Array(); Here sd is incrementing by 1. I have lots of data that I am...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7386
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7543
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...
1
7106
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
7534
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
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
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...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.