UserControl does not show on running form and properies do not show 
Author Message
 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!



Mon, 11 Apr 2005 22:48:33 GMT  
 UserControl does not show on running form and properies do not show
George,

Quick check, is the Visible Property true on both the UserControl and the
Label?

Kevin
--

-----------------------
This posting is provided "AS IS" with no warranties, and confers no rights

Quote:

> 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
> }
> }

> Thanks

> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!



Tue, 12 Apr 2005 05:57:45 GMT  
 UserControl does not show on running form and properies do not show
Yes,
since the solution was a test one, deleted it and recreate a new one
from scratch.
Now it is fine

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Tue, 12 Apr 2005 21:30:20 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to show a form from a usercontrol

2. OnInitDialog and doing something after the window is shown

3. toolbar does not show tootips on VB form

4. 2e modal form does not show

5. Start Min not showing when running from Today Plugin

6. static member inheritance not doing what I want...

7. Class not registered when doing COM interop

8. Strings doing what they are not supposed to...???

9. _open not doing the right thing

10. Enter key on dialog embedded in dialog not doing OnOK

11. ShellExecute does not exit when done

12. CTreeCtrl is not doing the business

 

 
Powered by phpBB® Forum Software