
UserControl does not show on running form and properies do not show
I created a simple dll UserControl with a label.
At design time when I drop it on the form, I can see the label. When the
form is running and is visible cannot see anything. Seems the
usercontral disappears. At the begining could not have access to the
label.text so made the label public in the user control. Still cannot
see the label on the form.
This is the usercontrol code
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace UserControl
{
/// <summary>
/// Summary description for testlabel.
/// </summary>
public class testlabel : System.Windows.Forms.UserControl
{
public System.Windows.Forms.Label label1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public testlabel()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitForm call
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(136, 40);
this.label1.TabIndex = 0;
this.label1.Text = "Test";
//
// testlabel
//
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.label1});
this.Name = "testlabel";
this.Size = new System.Drawing.Size(176, 56);
this.ResumeLayout(false);
}
#endregion
}
Quote:
}
Thanks
*** Sent via Developersdex http://www.*-*-*.com/ ***
Don't just participate in USENET...get rewarded for it!