By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,929 Members | 634 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,929 IT Pros & Developers. It's quick & easy.

Label in Panl Derived Class

P: n/a
I have a control that inherits from the Panel Class. To this, I added a
label which I want to use as a caption in my derived control. However, I
can't get the label to show up in the panel. I tried a text box and it works
fine. I've tried everything on the label from visible=True, BringToFront,
etc. but I can't get it to show up.

Is this a bug in VS or can one just not do this?
--
Dennis in Houston
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Dennis,

When you do not set a border or text in a label, you do not see it. Is that
not simple the problem?

Cor
Nov 21 '05 #2

P: n/a
Dennis,

When you do not set a border or text in a label, you do not see it. Is that
not simple the problem?

Cor
Nov 21 '05 #3

P: n/a
Thanks Cor but I've tried different borders as well as text. If I just add a
panel to a form then a label to the panel, it works fine. However, it
doesn't work from my derived control (derived from a panel). Thanks for
answer though.

"Cor Ligthert" wrote:
Dennis,

When you do not set a border or text in a label, you do not see it. Is that
not simple the problem?

Cor

Nov 21 '05 #4

P: n/a
Dennis,

I have selected an item usercontrol
Draged on that a panel docked it.
Draged "on" that a label

Build the solution

Set that usercontrol on a form

Debug

And than I see "Label1"

I hope this helps somehow?

Cor
Nov 21 '05 #5

P: n/a
Yes that works fine. But what I actually have is a control that I'm working
on that derives from a panel class. I add a label control to my derived
control and save that as a dll assembly.

I then start a new project and add my new control to the form. It's then
that I can't get the label to show up. If I add a label in my new project to
my control, it shows up fine but the one I added before doesn't show.

What I'm trying to do is create a control that has some Cells in a grid. I
add a text box and a label and then save it as user control assembly.dll.

I then start my new project and add an instance of my new control to a form.
The textbox shows up fine but the label won't show nor will a combo box,
listbox, button, etc. Only the text box shows up. The controls are there
becuse I can reference them in my control but no matter what I do, they
aren't visible.

Sorry if this is confusing. It's just that I'm getting frustrated with VS
not doing what it should do easily.

"Cor Ligthert" wrote:
Dennis,

I have selected an item usercontrol
Draged on that a panel docked it.
Draged "on" that a label

Build the solution

Set that usercontrol on a form

Debug

And than I see "Label1"

I hope this helps somehow?

Cor

Nov 21 '05 #6

P: n/a
Dennis,

When you give your questions in riddles you get the same answers and does
cost a lot of time to the people who wants to help in this newsgroup.

In my opinion is the last question very different from your first as well as
from your second.

Are you sure this code is at least in your usercontrol about the label?
Me.Label1.Location = _
New System.Drawing.Point(1, 1)
Me.Label1.Name = "Label1"
Me.Label1.Text = "MyLabel"
Me.Controls.Add(Me.Label1)

And than especially the last row?

I hope this helps?

Cor
Nov 21 '05 #7

P: n/a
Sorry about the lengthy explaination but I wasn't sure you were understanding
my problem. Your last note solved my problem. The line
"Me.Controls.Add(Me.Label1) wasn't being added by the Designer. All the
other lines were added correctly but not that one. Strange the Designer
would not add the most important line. Thanks for help. All the controls I
add to my control show up fine now if I add the line manually.

"Cor Ligthert" wrote:
Dennis,

When you give your questions in riddles you get the same answers and does
cost a lot of time to the people who wants to help in this newsgroup.

In my opinion is the last question very different from your first as well as
from your second.

Are you sure this code is at least in your usercontrol about the label?
Me.Label1.Location = _
New System.Drawing.Point(1, 1)
Me.Label1.Name = "Label1"
Me.Label1.Text = "MyLabel"
Me.Controls.Add(Me.Label1)

And than especially the last row?

I hope this helps?

Cor

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.