473,397 Members | 2,077 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Where Are My Labels Going?

Despite my bad cold and headache I should be able to correctly code
what I am trying to code below. Or should at least be able to
determine why such simple code does not work. I do have very similar
but more complicated code working in another project (thanks, I might
add, to several people here who have helped me).

The problem is that I never see the Labels. Using the debugger I can
see that the Text property of the Labels are correct. I could not
verify from the debugger that the Labels are actually being added to
the Panel Control, but I do not see how they could not be.
Dim chkbxSel(9) As CheckBox
Dim lbl(9) As Label

+ " Windows Form Designer generated code "

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles Button1.Click

'populate panel
Dim yloc As Integer = 0
For i As Integer = 0 To 9
lbl(i) = New Label
yloc = i * (lbl(i).Height + 4)
chkbxSel(i) = New CheckBox
chkbxSel(i).Tag = i
chkbxSel(i).Location = New Point(0, yloc)
lbl(i).Width = 200
lbl(i).Text = "CheckBox " & i.ToString
lbl(i).Location = New Point(20, yloc)
Panel1.Controls.Add(chkbxSel(i)) ' < I see the
CheckBoxes
Panel1.Controls.Add(lbl(i)) ' < But I do not
see the Labels
Next
End Sub

Nov 21 '05 #1
7 1209
Do you have the label backcolor set to transparent or the same color as your
form with border set to none?

"eBob.com" wrote:
Despite my bad cold and headache I should be able to correctly code
what I am trying to code below. Or should at least be able to
determine why such simple code does not work. I do have very similar
but more complicated code working in another project (thanks, I might
add, to several people here who have helped me).

The problem is that I never see the Labels. Using the debugger I can
see that the Text property of the Labels are correct. I could not
verify from the debugger that the Labels are actually being added to
the Panel Control, but I do not see how they could not be.
Dim chkbxSel(9) As CheckBox
Dim lbl(9) As Label

+ " Windows Form Designer generated code "

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles Button1.Click

'populate panel
Dim yloc As Integer = 0
For i As Integer = 0 To 9
lbl(i) = New Label
yloc = i * (lbl(i).Height + 4)
chkbxSel(i) = New CheckBox
chkbxSel(i).Tag = i
chkbxSel(i).Location = New Point(0, yloc)
lbl(i).Width = 200
lbl(i).Text = "CheckBox " & i.ToString
lbl(i).Location = New Point(20, yloc)
Panel1.Controls.Add(chkbxSel(i)) ' < I see the
CheckBoxes
Panel1.Controls.Add(lbl(i)) ' < But I do not
see the Labels
Next
End Sub

Nov 21 '05 #2
Also, what is the height of your labels and checkbox's. Maybe the label is
behind the checkbox.

"eBob.com" wrote:
Despite my bad cold and headache I should be able to correctly code
what I am trying to code below. Or should at least be able to
determine why such simple code does not work. I do have very similar
but more complicated code working in another project (thanks, I might
add, to several people here who have helped me).

The problem is that I never see the Labels. Using the debugger I can
see that the Text property of the Labels are correct. I could not
verify from the debugger that the Labels are actually being added to
the Panel Control, but I do not see how they could not be.
Dim chkbxSel(9) As CheckBox
Dim lbl(9) As Label

+ " Windows Form Designer generated code "

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles Button1.Click

'populate panel
Dim yloc As Integer = 0
For i As Integer = 0 To 9
lbl(i) = New Label
yloc = i * (lbl(i).Height + 4)
chkbxSel(i) = New CheckBox
chkbxSel(i).Tag = i
chkbxSel(i).Location = New Point(0, yloc)
lbl(i).Width = 200
lbl(i).Text = "CheckBox " & i.ToString
lbl(i).Location = New Point(20, yloc)
Panel1.Controls.Add(chkbxSel(i)) ' < I see the
CheckBoxes
Panel1.Controls.Add(lbl(i)) ' < But I do not
see the Labels
Next
End Sub

Nov 21 '05 #3
"eBob.com" <eB******@totallyfakeisp.com> schrieb:
Despite my bad cold and headache I should be able to correctly code
what I am trying to code below. Or should at least be able to
determine why such simple code does not work. I do have very similar
but more complicated code working in another project (thanks, I might
add, to several people here who have helped me).

The problem is that I never see the Labels.


Maybe the problem is caused by an unpatched virus scanner. These symptoms
are typically caused by a McAfee VirusScan problem that NAI is aware of and
that can be fixed by installing a patch:

Patch 5 for McAfee VirusScan Enterprise 8.0i
<URL:https://knowledgemap.nai.com/phpclient/viewKDoc.aspx?url=kb/kb_kb38717.xml&docType=DOC_KnowledgeBase>

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

Nov 21 '05 #4
Bob,

Your checkbox is hiding the label
\\\\
lbl(i).Location = New Point(110, yloc)
////

Without the perfect ones are we probably all making this kind of mistakes
and know that they consume the most time.

:-)

I hope this helps,

Cor
Nov 21 '05 #5
Addendum:

I tested your code... The problem is that the checkboxes are so large that
the labels are hidden behind them. Change the 20 in 'lbl(i).Location = New
Point(20, yloc)' to a larger value. BTW: The checkbox has a 'Text'
property, so there is no need to add a caption by placing a label next to
it. Simply assign the caption string to its 'Text' property.

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

Nov 21 '05 #6
Thank you Herfried. I suspected something like that and tried different
values for location and size, but apparently didn't hit the right
combination. And thanks for making me aware of the Text property of
CheckBox. That will be very useful to me.

Bob

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uW**************@TK2MSFTNGP15.phx.gbl...
Addendum:

I tested your code... The problem is that the checkboxes are so large that the labels are hidden behind them. Change the 20 in 'lbl(i).Location = New Point(20, yloc)' to a larger value. BTW: The checkbox has a 'Text'
property, so there is no need to add a caption by placing a label next to
it. Simply assign the caption string to its 'Text' property.

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

Nov 21 '05 #7
Thank you Cor. Poor debugging on my part. I should have eliminated the
CheckBoxes. Then I would have seen the Labels and realized that the problem
was some interaction between the two.

Thanks again, Bob

\
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl...
Bob,

Your checkbox is hiding the label
\\\\
lbl(i).Location = New Point(110, yloc)
////

Without the perfect ones are we probably all making this kind of mistakes
and know that they consume the most time.

:-)

I hope this helps,

Cor

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Martin O'Rourke | last post by:
All, I am hoping someone might be able to put me out of my misery and let me know if it is possible or not to dervie the name of an element in a form, based on its associated label, only knowing...
7
by: Shyguy | last post by:
I have an option group with about 30 options. I would like to have the Option Labels get their text from a table. Is this possible, and if so how? Also, is it possible to embad a font into a...
3
by: Grim Reaper | last post by:
I print mailing labels out of Access 2000 databases about 3 to 4 times a week. I have been having problems with one thing since I have been printing mailing labels. I print mailing labels by...
3
by: Grim Reaper | last post by:
I know this is probably an easy question, but I could not find/figure it out. Basically, I am printing mailing labels with a "Sorting/Grouping" section that groups the label types together....
7
by: Jared | last post by:
Here is my situation. I have multiple labels on a form but only certain ones will become visible while using the form. Depending on which check box(s) you pick, on another form, determines the...
1
by: dmalhotr2001 | last post by:
Hi, I have to print avery labels 5960 using a webpage? How do I accomplish this with asp.net? I know there is a way with word however I'm not going to opt because people won't have microsoft...
2
by: Ahmed | last post by:
Hello everyone, I am using Visual Studio 2003 Enterprise Architect. Everytime I build the project, some of the labels move 2 pixels down. I even locked those labels. No Good. Any idea whats...
5
by: Mel | last post by:
I created a header that adjusts with the size of the browser windows. How do I place labels in the header section so they also maintain their position when the window is resized? One of the labels...
4
by: Jon Harrop | last post by:
I am writing a 3D graphing component built upon WPF and would like to have 2D vector graphics (e.g. typeset mathematics) as labels laid out from 3D coordinates. For example, a tick on an axis has a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.