Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2005

Tip: Looking for answers? Try searching our database.

label.visible does not work

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bugym - 14 Feb 2005 17:25 GMT
I'm developing a quite comlex form containing a user control in C#

In the user control I'm trying to set a simple label to be visible:

labelState.Visible = true;

The debugger showns me, that the labelState.Visible is false
before entering this line of code.
But it is still false after this line of code!!!
Can anyone please explain, how this can happen?

I have double checked that I have not defined an event on this label that
resets the value to false.

Is there any posiible condition that does not allow to set a label's
visibility to true?

Regards

  Burkhard Mahr

-------------------------
Label Initialization Code:
this.labelState.Anchor =
((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top |
System.Windows.Forms.AnchorStyles.Right)));

this.labelState.BackColor = System.Drawing.Color.Transparent;
this.labelState.Font = new System.Drawing.Font("Microsoft Sans Serif",
8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point,
((System.Byte)(0)));
this.labelState.Location = new System.Drawing.Point(870, 4);
this.labelState.Name = "labelState";
this.labelState.Size = new System.Drawing.Size(44, 16);
this.labelState.TabIndex = 16;
this.labelState.Text = "Status";


Herfried K. Wagner [MVP] - 14 Feb 2005 17:49 GMT
"bugym" <bugym@discussions.microsoft.com> schrieb:
> Is there any posiible condition that does not allow to set a label's
> visibility to true?

If the label is not visible because its parent container is not visible (or
the form that contains the label is not visible), then setting its 'Visible'
property to 'True' doesn't have any effect, which means that the property
will still return 'False' until the control becomes visible.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

bugym - 15 Feb 2005 10:39 GMT
Thanks a lot Herfried!
Your hint was the key to solve the problem.
Indeed I found a parent control that was not visible
Thanks & Regards
        Burkhard

> "bugym" <bugym@discussions.microsoft.com> schrieb:
> > Is there any posiible condition that does not allow to set a label's
[quoted text clipped - 4 lines]
> property to 'True' doesn't have any effect, which means that the property
> will still return 'False' until the control becomes visible.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.