Labels not accessible in code view?

cjard

Well-known member
Joined
Apr 25, 2006
Messages
7,081
Programming Experience
10+
I note with interest that any labels created by a wizard when I drag a field out of my data sources window, and onto my form, dont appear in the code view..

For example, I drag a text column called THE_TEXT from the datasources window onto the form and the following appear:

THE_TEXTTextBox (as TextBox)
THE_TEXTLabel (as Label)


If i go to code view and type THE<ctrl+space> I see only THE_TEXTTextBox in autocomplete

Where did the label go?
 
cardboard analysis time.. It appears that labels are dimmed in the InitializeComponent and are hence lost out of scope when the method finishes. They remain visible because the Controls collection holds reference to them..

I suppose that means if i want to use one in my code without upsetting the designer i should either:


In the .Designer.vb code file (normally hidden) move it out of the InitComponents and into the class level variables declaration area

OR

use Me.Controls("THE_TEXTLabel") in my code??
 
WHAT? Have you done something funny with your labels.... because I've never had that experience with them. I've always had access to my labels.... infact, I was just working with some last night and messed with their .Text property in the code..... ???

Having said that, I'm off to double check things and see if I need to remove my foot from my mouth.

-tg
 
Back
Top