473,666 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2975
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******@pcdata sheet.com
www.pcdatasheet.com
"Jared" <jm*****@hotmai l.com> wrote in message
news:96******** *************** ***@posting.goo gle.com...
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.Capt ion = "This"
Else
Me.Mylabel.Capt ion = "That"
End If

--
Reggie

----------
"PC Datasheet" <no****@nospam. spam> wrote in message
news:o_******** **********@news read2.news.atl. earthlink.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******@pcdata sheet.com
www.pcdatasheet.com
"Jared" <jm*****@hotmai l.com> wrote in message
news:96******** *************** ***@posting.goo gle.com...
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*****@hotmai l.com> wrote in message
news:96******** *************** ***@posting.goo gle.com...
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(Cance l As Integer)
Dim Location As Integer
Dim NullChecks As Integer
Location = 250
NullChecks = 0

If [Forms]![Testfrm].IsNP.Value = -1 Then
Forms![popupfrm].NPLABEL.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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*****@hotmai l.com> wrote in message
news:96******** *************** ***@posting.goo gle.com...
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(Cance l As Integer)
Dim Location As Integer
Dim NullChecks As Integer
Location = 250
NullChecks = 0

If [Forms]![Testfrm].IsNP.Value = -1 Then
Forms![popupfrm].NPLABEL.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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.Visibl e = 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**********@N oSpamsmittysine t.com> wrote in message news:<ur******* *************@c omcast.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.Heigh t

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
3465
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 the value of the label, and working on the assumption that the <label for="???" links to the <select id="???" Below is the html that I am working from, which has been dynamically created. Unfortunately I have no control over this at all. I...
3
3211
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 http://www.captainsoftheworld.com/modernrepublic/strict/ModernRepublic.css Is it possible, without messing around with per-pixel positioning or sizing, to make the labels ("Name" & "E-mail") in the Mailing List form line up with their associated text-input areas? In my system's setup (using IE6) the labels...
2
2996
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 labels....due to slippage, soon you have the printout missing the label. So we are thinking that we have to use sheets of labels. HOWEVER, one job may need 15 labels, another may need 8, etc. Does anyone have a solution for how to set this up in...
3
2330
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. Also, I am using a "Report Header" to show a count of how many total labels that are being printed. Now, my problem is that without the "Report Header", the spacing is perfect. But, when I add the Report Header, it gets shifted downwards and the...
1
7483
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 a blank form with three private members (label1, label2, and label3) and adding the following code to the form's constructor: // BEGIN CODE
2
1475
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 send as a parameter ,... so Please , help me ,.. cause it doest work ! '---------------------------------------------------------- --------------
1
1918
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 be prompt an input box to enter employee names and sales figures. The output then will be displyed in only 1 label using a For loop. The layout would be under 3 columns: Employee name (left justified), Sale figures (right justified) and Bonus...
2
4138
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 for="thisCheck">Check this if you want a copy</label><br/> </td>
3
11954
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 table. What is the best way to do this properly with CSS? Note: I don't want to define fixed widths for certain columns or whatever. The width for the labels should just be automatically as much as necessary to fit the widest label. I first...
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.