469,630 Members | 1,202 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,630 developers. It's quick & easy.

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 3782
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 gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.