Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 5th, 2006, 09:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default Adding Controls to User Control

Hello,

I'm trying to add custom controls to a user control, and render them to it. I have a viewer user control in which several of these controls are built:

                //Create a verse item and assign the values to the property
                VerseItem verseControl = new VerseItem();
                verseControl.Visible = true;
                verseControl.Enabled = true;
                verseControl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
                verseControl.Number = verse.Number;
                verseControl.Text = verse.Text;
                //Add the control to the collection
                this.Controls.Add(verseControl);

Then after the for loop, I invalidate the user control, but nothing is showing? I'm sure I'm doing something wrong; how do I add controls to this control? Do I have to add it to a panel in the user control instead?

Thanks.


Brian
__________________
Brian





Similar Threads
Thread Thread Starter Forum Replies Last Post
Accessing controls in host page from User Control Axe BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X 1 March 16th, 2011 06:22 AM
Error adding Report Viewer Control in Web User Con everest ASP.NET 2.0 Professional 0 January 29th, 2008 07:24 PM
User controls' content: Chapter 2 User Controls AGS BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 10 July 26th, 2007 05:36 AM
Accessing the Controls of a User Control? Aaron Edwards ASP.NET 2.0 Basics 6 June 16th, 2006 07:22 PM
User Control within Custom Server Controls www2004 ASP.NET 1.x and 2.0 Application Design 3 April 15th, 2005 09:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.