473,503 Members | 12,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C# app: what's wrong with my control here?

4 New Member
Alright, I was a PHP and flash developer before .NET, and so I am used to using dynamic variables in loop situations like these. But let me explain what I'm trying to do.

Basically, there is a custom control that loops through a List<Product> when it is received, and displays smaller "UserControl2" controls for every product in that list. However, when I run this code for some reason, the UserControl2 objects do not show up. No idea why. Here's the method:

private List<UserControl2> controlist = new List<UserControl2>();

public void SetProductSource( Product[] ProductSource )
{


for (int ii = 0; ii < ProductSource.Length; ++ii)
{
UserControl2 newcontrol = new UserControl2();

newcontrol.Name = "NewControl" +ii.ToString();

newcontrol.Location = new Point( 0, (HeightPerItem + ItemSpacing) * ii );
newcontrol.Size = new Size( 676, 158 );
newcontrol.SetProduct( ProductSource[ii] );
newcontrol.Visible = true;
newcontrol.BringToFront();
controlist.Add( newcontrol );
}
}
Aug 26 '08 #1
2 829
leimeisei
4 New Member
My apologies, I did not set the Parent attribute on the objects I was creating. Delete this question if you'd like.
Aug 26 '08 #2
Plater
7,872 Recognized Expert Expert
You also could have added the controls to the control collection on the parent object.
Such as a this.Controls.Add() (or in VBNET me.Controls.Add() )
Aug 26 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
1622
by: Roy Lawson | last post by:
I want to enable the user to define parts of their user interface. I am developing an application that does some accounting functions (basicly the end user enters revenues for each account, and...
10
2380
by: BBFrost | last post by:
We just recently moved one of our major c# apps from VS Net 2002 to VS Net 2003. At first things were looking ok, now problems are starting to appear. So far ... (1) ...
3
3335
by: AdamM | last post by:
Hi all, When I run my VbScript, I get the error: "ActiveX component can't create object: 'getobject'. Error 800A01AD". Any ideas what I did wrong? Here's my VBScript: dim o set...
5
3938
by: Stuart | last post by:
Hi There Probably missing something drastically obvious here.... I have just moved an .asp application from a test IIS server to a running IIS server and have become confused... I am using...
8
3099
by: Brendan Reynolds | last post by:
I'm trying to integrate SQL Server Reporting Services reports into an ASP.NET app (SRS 2000, ASP.NET 1.1). I know how to do this using direct URL addressing, but this exposes in the query string...
15
1327
by: Peter B.L. Rasmussen | last post by:
I want to start an app, and at the same time control where it is placed. I use the following code, but it doesn't seem to work. The MoveWindow call doesn't move the window. What am I doing wrong?...
2
3601
by: Rod | last post by:
I've been struggling with this thing for 2 days, and after searching the 'net for help, I cannot find what is wrong. We're using Crystal Reports XI Release 2, with Visual Studio .NET 2003 in...
6
1413
by: NickP | last post by:
Hi there, I am implementing a simple "/U" command line argument for a .NET application that instructs the application to delete the following folders... ...
12
1862
by: =?Utf-8?B?S2plbGw=?= | last post by:
Hello I've taken a four days training in C#, very good training, experienced teacher and all that, very positive. Went home spent a week making my first application, slightly more than the...
1
2348
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will...
0
7067
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
7264
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
7316
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
6975
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
7449
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...
1
4992
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
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
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
371
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.