472,108 Members | 1,376 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,108 software developers and data experts.

Label not visible

Hi,
I am trying to create a Label for a Windows Form, with my own code.
Its not being visible. The code being used is the following.

Label x = new Label();
x.Name = "node1";
x.Location = new System.Drawing.Point(200, 200);
x.Text = "Hello";
x.TabIndex = 1;
x.Show();
x.Refresh();
Can someone help.
Thanks
Nov 16 '05 #1
2 3856
Hi Xarky,

You need to put the Label into a container control, for instance a windows
form.

this.Controls.Add(x);

--
Happy Coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #2
Hi,

I think you got to add it to the place where you want it to be visible..
in ur case it seems that u want it to be displayed in the form..

so ...

Label x = new Label();
x.Name = "node1";
x.Location = new System.Drawing.Point(200, 200);
x.Text = "Hello";
x.TabIndex = 1;
this.Controls.add(x);

Nirosh.
"Xarky" <be*********@yahoo.com> wrote in message
news:bc*************************@posting.google.co m...
Hi,
I am trying to create a Label for a Windows Form, with my own code.
Its not being visible. The code being used is the following.

Label x = new Label();
x.Name = "node1";
x.Location = new System.Drawing.Point(200, 200);
x.Text = "Hello";
x.TabIndex = 1;
x.Show();
x.Refresh();
Can someone help.
Thanks

Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Xerxes | last post: by
5 posts views Thread by dcstech | last post: by
31 posts views Thread by jcrouse | last post: by
3 posts views Thread by Neil Wallace | last post: by
5 posts views Thread by dgardner | last post: by
2 posts views Thread by =?Utf-8?B?Y2FzaGRlc2ttYWM=?= | last post: by
9 posts views Thread by =?Utf-8?B?RnJhbmsgVXJheQ==?= | last post: by
reply views Thread by leo001 | last post: by

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.