473,382 Members | 1,202 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,382 software developers and data experts.

Aligning Labels: not the text but the label itself.

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 labels
that appear. I have that much working as of now. What I need to know
is, how do I format the labels to align underneath one and other. So
when I check the first check box, the corresponding label appears and
when I check the third check box it's label appears directly
underneath the first label leaving no gap or space for the invisible
second label.

Any help would be greatly appreciated.
Thank you.

Jared
Nov 13 '05 #1
7 2954
You need to set the Top and Left properties of the labels in your checkboxes
code.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Jared" <jm*****@hotmail.com> wrote in message
news:96**************************@posting.google.c om...
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 labels
that appear. I have that much working as of now. What I need to know
is, how do I format the labels to align underneath one and other. So
when I check the first check box, the corresponding label appears and
when I check the third check box it's label appears directly
underneath the first label leaving no gap or space for the invisible
second label.

Any help would be greatly appreciated.
Thank you.

Jared

Nov 13 '05 #2
Jared, other things you could do so you don't have to worry about
hiding/realigning etc. are:
1-You could align them exactly where you want them in design view. Just
place one on top of the other. If/when you want to work with the one that
is behind the other one, select the top label then select the Format/Send to
back. Now you can select and edit the label that was behind the first one.

2-Instead of using 2 labels you could use the same label and change the
caption property instead of visible property. So depending on the checkbox
selected you could say"
If mycheck = True Then
Me.Mylabel.Caption = "This"
Else
Me.Mylabel.Caption = "That"
End If

--
Reggie

----------
"PC Datasheet" <no****@nospam.spam> wrote in message
news:o_******************@newsread2.news.atl.earth link.net...
You need to set the Top and Left properties of the labels in your checkboxes code.

--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com
"Jared" <jm*****@hotmail.com> wrote in message
news:96**************************@posting.google.c om...
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 labels
that appear. I have that much working as of now. What I need to know
is, how do I format the labels to align underneath one and other. So
when I check the first check box, the corresponding label appears and
when I check the third check box it's label appears directly
underneath the first label leaving no gap or space for the invisible
second label.

Any help would be greatly appreciated.
Thank you.

Jared


Nov 13 '05 #3
The problem with that is, I will have somewhere around 15 labels, and
depending on which box is checked, any combination of labels could be
visible. There are too many combinations to write code for that
solution to work. It was a good idea though and definitely would work
if I only had 2 labels.

It's also not a simple as to just set the top and left properties.
When you do that you have to enter in specific numbers for the
location. If I could enter "Justify" in the top and left alignment
properties I would be done by now. Unfortunately I can't or just don't
know how to. Is there a way I could write a code that would do this?

Thanks for the ideas.
Nov 13 '05 #4
I guess my only question is if it's possible to write code to set the labels
visible property, then why not just change the caption of the labels. That
way they will always be aligned because you will be using the same label..
Maybe I'm not understanding what exactly you are trying to accomplish.
Sorry I couldn't help!

--
Reggie

----------
"Jared" <jm*****@hotmail.com> wrote in message
news:96**************************@posting.google.c om...
The problem with that is, I will have somewhere around 15 labels, and
depending on which box is checked, any combination of labels could be
visible. There are too many combinations to write code for that
solution to work. It was a good idea though and definitely would work
if I only had 2 labels.

It's also not a simple as to just set the top and left properties.
When you do that you have to enter in specific numbers for the
location. If I could enter "Justify" in the top and left alignment
properties I would be done by now. Unfortunately I can't or just don't
know how to. Is there a way I could write a code that would do this?

Thanks for the ideas.

Nov 13 '05 #5
Figured it out. Here is my code. It's not my complete code but here is
an example of six labels being put in a line depending on which check
box is checked and also a label that appears if no check boxes are
check.
[Forms]![Testfrm] is the form that contains the check boxes. The
labels are on their own form.

The IsXX are my check box names and there corresponding labels are
named XXLabel.

The variable "Location" was is to set the location of the label,
having it move up and down throughout the form depending on which
check boxes were checked.

The variable "NullChecks" was is to keep track of the number of check
boxes that are not check and if the total equals the total number of
check boxes then a the only thing that will become visible is a label
say no check boxes were checked.
Private Sub Form_Open(Cancel As Integer)
Dim Location As Integer
Dim NullChecks As Integer
Location = 250
NullChecks = 0

If [Forms]![Testfrm].IsNP.Value = -1 Then
Forms![popupfrm].NPLABEL.Visible = True
NPLABEL.Left = 500
NPLABEL.Top = Location
Else: Location = Location - 500
NullChecks = NullChecks + 1

End If

If [Forms]![Testfrm].IsTS.Value = -1 Then
Forms![popupfrm].TSLABEL.Visible = True
Location = Location + 500
TSLABEL.Top = Location
TSLABEL.Left = 500
Else: NullChecks = NullChecks + 1

End If

If [Forms]![Testfrm].IsJG.Value = -1 Then
Forms![popupfrm].JGLABEL.Visible = True
Location = Location + 500
JGLABEL.Top = Location
JGLABEL.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check16.Value = -1 Then
Forms![popupfrm].Label16.Visible = True
Location = Location + 500
Label16.Top = Location
Label16.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check18.Value = -1 Then
Forms![popupfrm].Label18.Visible = True
Location = Location + 500
Label18.Top = Location
Label18.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check20.Value = -1 Then
Forms![popupfrm].Label20.Visible = True
Location = Location + 500
Label20.Top = Location
Label20.Left = 500
Else: NullChecks = NullChecks + 1
End If

If NullChecks = 6 Then
Forms![popupfrm].LabelC.Visible = True
LabelC.Top = 250
LabelC.Left = 500
Else: Forms![popupfrm].LabelC.Visible = False
End If

End Sub

Something that confused me was when i entered a value for the Location
variable, it had to be a large number to make the label move. I first
tried numbers from 1 to 10 thinking that the code would think i meant
inches, i was wrong. I don't know what the code is thinking. Turns out
i needed to use values of at least 50 to see the label move, even then
it didn't move much. I ended up going with 250 and 500.

Anyway, I just thought I would post this in case anyone else was
interested or had the same scenario .
Nov 13 '05 #6
The small movement is because the values are expressed in twips(I believe).
Twip:
=====
A screen-independent unit used to ensure that placement and proportion of
screen elements in your screen application are the same on all display
systems. A twip is a unit of screen measurement equal to 1/20 of a
printer's point. There are approximately 1440 twips to a logical inch or
567 twips to a logical centimeter (the length of a screen item measuring one
inch or one centimeter when printed).
--
Reggie

----------
"Jared" <jm*****@hotmail.com> wrote in message
news:96**************************@posting.google.c om...
Figured it out. Here is my code. It's not my complete code but here is
an example of six labels being put in a line depending on which check
box is checked and also a label that appears if no check boxes are
check.
[Forms]![Testfrm] is the form that contains the check boxes. The
labels are on their own form.

The IsXX are my check box names and there corresponding labels are
named XXLabel.

The variable "Location" was is to set the location of the label,
having it move up and down throughout the form depending on which
check boxes were checked.

The variable "NullChecks" was is to keep track of the number of check
boxes that are not check and if the total equals the total number of
check boxes then a the only thing that will become visible is a label
say no check boxes were checked.
Private Sub Form_Open(Cancel As Integer)
Dim Location As Integer
Dim NullChecks As Integer
Location = 250
NullChecks = 0

If [Forms]![Testfrm].IsNP.Value = -1 Then
Forms![popupfrm].NPLABEL.Visible = True
NPLABEL.Left = 500
NPLABEL.Top = Location
Else: Location = Location - 500
NullChecks = NullChecks + 1

End If

If [Forms]![Testfrm].IsTS.Value = -1 Then
Forms![popupfrm].TSLABEL.Visible = True
Location = Location + 500
TSLABEL.Top = Location
TSLABEL.Left = 500
Else: NullChecks = NullChecks + 1

End If

If [Forms]![Testfrm].IsJG.Value = -1 Then
Forms![popupfrm].JGLABEL.Visible = True
Location = Location + 500
JGLABEL.Top = Location
JGLABEL.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check16.Value = -1 Then
Forms![popupfrm].Label16.Visible = True
Location = Location + 500
Label16.Top = Location
Label16.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check18.Value = -1 Then
Forms![popupfrm].Label18.Visible = True
Location = Location + 500
Label18.Top = Location
Label18.Left = 500
Else: NullChecks = NullChecks + 1
End If

If [Forms]![Testfrm].Check20.Value = -1 Then
Forms![popupfrm].Label20.Visible = True
Location = Location + 500
Label20.Top = Location
Label20.Left = 500
Else: NullChecks = NullChecks + 1
End If

If NullChecks = 6 Then
Forms![popupfrm].LabelC.Visible = True
LabelC.Top = 250
LabelC.Left = 500
Else: Forms![popupfrm].LabelC.Visible = False
End If

End Sub

Something that confused me was when i entered a value for the Location
variable, it had to be a large number to make the label move. I first
tried numbers from 1 to 10 thinking that the code would think i meant
inches, i was wrong. I don't know what the code is thinking. Turns out
i needed to use values of at least 50 to see the label move, even then
it didn't move much. I ended up going with 250 and 500.

Anyway, I just thought I would post this in case anyone else was
interested or had the same scenario .

Nov 13 '05 #7
"Reggie" <No**********@NoSpamsmittysinet.com> wrote in message news:<ur********************@comcast.com>...
The small movement is because the values are expressed in twips(I believe).
Twip:
=====
A screen-independent unit used to ensure that placement and proportion of
screen elements in your screen application are the same on all display
systems. A twip is a unit of screen measurement equal to 1/20 of a
printer's point. There are approximately 1440 twips to a logical inch or
567 twips to a logical centimeter (the length of a screen item measuring one
inch or one centimeter when printed).
--
Reggie


Reggie is correct about the units that are used for placement. You
don't have to deal with twips directly if you do something like:

MyControl.Top = MyControl.Top + intHowManyDown * MyControl.Height

James A. Fortune
Nov 13 '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...
3
by: Geoff Hague | last post by:
I've got a small little problem with my 'website-in-progress': http://www.captainsoftheworld.com/modernrepublic/strict/index.php...
2
by: DBQueen | last post by:
I have a database which will be printing out labels for SMALL test tubes (1/4" high). We have yet to find a reasonably-priced printer (labelwriter) which can effectively print this on ROLLS of...
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....
1
by: Kyle Blaney | last post by:
When labels are vertically stacked on top of one another and have their TextAlign property set to MiddleRight, the text is not properly right-aligned. You can reproduce this problem by creating...
2
by: Giovane Calabrese | last post by:
( aspx + vb ) hi everyone ! I really need make that function work ! im brazilian , and i want to make a multilanguage system , that function above must look at all ASPX take the labels ID and...
1
by: Linux Boy via .NET 247 | last post by:
(Type your message here) Hi everyone, I would like to ask a question about aligning text within one label. I have an application that everytime the user click on Enter Record button, they will...
2
by: Casimir | last post by:
What would be the correct way to align checkboxes and their labels, in your opinion? For example .... <td> <input type="checkbox" class="cbox" name="thisCheck" /> <label...
3
by: Bram2 | last post by:
When putting a form on a webpage, I prefer the labels and edit boxes for all fields to be aligned, e.g. like this: http://i44.tinypic.com/6dvceo.png This is easily done by putting it all in a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.