Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Bolding Part Of A Label Caption


I have a label caption that i set based on an option chosen in an option group.

Is there anyway to bold only certain words within the label caption ? Some sort of formatting i can apply ?

Should i use a rich text box instead ?


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing Colour Of Part Of The Caption For The Label
Label1.Caption="I am John"

The default Forecolour property of the Label displayed on the form is set to black.
How can I make the color of the words change one by one after a delay.
Example: "I" change to blue first, then after 3 seconds, "am" change to blue and after another 3 seconds, John changes to blue.
any help will be very much appreciated. Thank you!

Vertical Scroll For Label Caption Part 2
Does anyone have a handy snippet for scrolling a label caption vertically line by line? All the examples I could find here are for horizontal marquee type scrolling. I want the user to be able to click an up or down button to scroll both ways. Getting it to scroll down is easy with the Mid function, but going back up - ?

Adding Of Label Numeric Label Caption Together
I have a label with a value of 00:00:06 (numeric)as the caption. Ihave another label with a numeric caption of 00:00:03. How do I add both captions together to get a result on a third label caption?. What is the formula I should use?

Thanks in advance


Adding Of Label Numeric Label Caption Together
I have a label with a value of 00:00:06 (numeric)as the caption. Ihave another label with a numeric caption of 00:00:03. How do I add both captions together to get a result on a third label caption?. What is the formula I should use?

Thanks in advance


Handle From Part Caption
How is this done? I have a sub for it but it just returns true or false.. it doesn't give the handle.

Blink A Part Of Your Caption
Dear friends, try the code below. The question is i don't want the positon of right heading (Task List)shifted even a bit.

Question 2 - any calculation to replace the statement like - "space(52)" (52 becomes litral) to make this sub function generalized?

Question 3 - Any vb command or API available to achieve the same?

Dim toggle As Integer
Dim headleft As String
Dim headcentre As String
Dim headright As String
Dim heading As String
Dim headingblank As String
Dim lenheadright As Integer
Dim lenheadcentre As Integer
Dim lenheadleft As Integer

Private Sub Form_Load()
toggle = 1
headleft = "Entry Screen"
headright = "Task List"
dispheading headleft, headcentre, headright

Private Sub dispheading(headl As String, headc As String, _
headr As String)
lenheadleft = Len(headl)
lenheadcentre = Len(headc)
lenheadright = Len(headr)
heading = headleft + Space(52) + headcentre + Space(50) + _
headingblank = headleft + Space(77) + Space(lenheadcentre) + _
Space(50) + headright
End Sub

Private Sub timerheading_Timer()
'timerheading is the name of the timer control
If toggle = 1 Then
toggle = 2
frmMain.Caption = heading
toggle = 1
frmMain.Caption = headingblank
End If
End Sub

If Label Caption > Label Size
Good Day,

I want to code a function that determine if the Label Caption is bigger than the Label size. Then, I would reduce the font size at RunTime.
I don't want to use the autosize property.

Is there a way to know if the content of a label is bigger than the label size ?

Many Thanks

N00b Question: String And Text Part Of Caption
My problem is that i want to combine a string and my own text into a caption


lblDisplay.caption = {string} "My text here"

so the output would be a lable that has "[string] My text here"

any help is appreciated

Colored Part Of The Label??
I have a label with I want to colored part of the text.


Label1.Caption = "I love VB"

I want "I love" to have Blue Color and "VB" to be Red in color..

Is this possible??

Event in Text Box

Any ideas

Controlling Part Of Label
i working on project that has section contains voice speaking ,, this voice suppose 2 read the written sentence in the label.. what i want is when the voice read the first word the color of t should be changed & when the voice move 2 the second word then the color of first one will return 2 the original color & the color of second word should be changed & so on ....

plz help me in doing that & i'll b thankful

Controling Part Of Label

i working on project that has section contains voice speaking ,, this voice suppose 2 read the written sentence in the label.. what i want is when the voice read the first word the color of t should be changed & when the voice move 2 the second word then the color of first one will return 2 the original color & the color of second word should be changed & so on ....

plz help me in doing that & i'll b thankful

Determine If Label Caption Width Is Greater Than Label Width
Is there anyway to add a check to deteremine if a caption of a label is longer than the label width, and if it is, omit the last few characters to make it fit and add "..."

Example: If "How are you doing?" doesn't fit in the label, it'll show "How are y..." instead.

I am going to increase the number of a label, which code is better to use ?

For I = 1 To 10
lblTotal.Caption = Val(lblTotal.Caption) + 1
Next I

For I = 1 To 10
Val(lblTotal.Caption) = Val(lblTotal.Caption) + 1
Next I

Label Caption
how do i make a label be two lines of info.

say i say...

lbl1.caption = "This is my information"

how would i make "my infomration on the second line of the label to make it look like

This is
my information.

Label Caption Help

I am wanting to make a label that will show some of the values of text boxes


there is a text box called name, were you obv put your name, how do i get the label to have a caption of:

Hi (value of name text box) how are you?

all this needs to happen when you click a command button.

I have tried:

Private Sub cmdCalculate_Click()
lblquote.Caption = "Hello ((txtname.text)) Are you ok?"
End Sub

Label Caption
when i want to type a caption as "L.R.No & Dt." to any label then it types as
"L.R.No _ Dt." can we avoid this ?

Label Caption
Hi all,
I need to display the command button label caption in an angular fashion.
Does anybody know how to do it?Is there any ocx file for it?

Or is there any special label control in which the text can be aligned with the horizontal?

Label Caption Help
how can i ave a label caption only show text before :ie if the
caption is abba:1234 ,345,00~##the caption is taken from
a text that has been opened so i cant change the text file.

any help please.bosscat.

Help.... Label Caption
How to change Label caption in code,


(((Gue kasih yang mudah nichh, masa kagak bisa juga)))

Label Caption Colours
Say I do this

label1.caption = "Textextextextext"
Now what I want to do is, add some more text to the label, but in a different colour. Is this possible?

Label.caption Not Reading....
lblfirst.Caption = frmmainscreen.lblnameentered.Caption

This is in form_load event.

I want the caption of lblfirst to be the same as frmmainscreen.lblnameentered.caption but instead it gives me a blank caption with nothing in it?

I'm pretty sure this is the correct code.

Label Caption Is Not BLINKING....[HELP!!]
I've followed the solution provided by others to make the label blink....However, it only works if the Timer1.Enabled = true and Timer1.Interval = 500 is located in the Form_Load

I want the label to blink at a click of a button...can somebody help me out??

& In Label Caption Displays As _
Is there a way around this issue

Label.caption="Joe & Fred"
Displays as Joe_Fred

I have always just put up with it,

Any ideas?

Label.caption Problem

I have a loop which sends some data via com port. I would like the loop to display how much % of data has already been sent.

My problem is that the next program displays the % ONLY when it is finished ( thats 100% ) and not alsow during data transaction. What should I do?

Label3 is the label to display %.

Dim a(10000) As Byte
Dim b As Long
Dim c As Long

ProgressBar1.Max = 10000
c = 100 / 10000

For b = 0 To 10000
MSComm1.Output = Chr$(a(b))
ProgressBar1.Value = b
Label3.Caption = c * b & "%"
Next b

Best Regards

Label Changes It's Caption Every 5 Seconds
i want that the label change it's caption every 5 seconds
how can i make that

Adding To A Label's Caption
ok i got this code

label1.caption = label1.caption + 1

ok simple enough i set the caption to 1

but it wont work i just want it to add to the label's caption every click of a command!!!!

Label Caption Question
Ok i want to use 2 labels to turn on and off a chat scan feature. When you start the Scan the label caption changes to "" and the lblScanRoom1 "Scanning Room..." but when i click on the Scanning Room... it doesn't go back to lblScanRoom caption "Scan Room"

what is wrong here?

Private Sub lblScanRoom_Click()
If lblScanRoom.Caption = "Scan Room" Then
lblScanRoom.Caption = ""
lblScanRoom1.Caption = "Scanning Room..."
objScanChat.Scan ChatScanOn
lblScanRoom.Caption = "Scan Room"
objScanChat.Scan ChatScanOff
lblScanRoom1.Caption = ""
End If
End Sub
Edit: JDT fixed code tags

Label Won't Change Caption
Label will not print caption on screen in runtime:

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Kount% = Kount% + 1
Labull Kount%
FilterTrans Text1.Text, Kount%
Z$ = Text1.Text
Text1.Text = ""
If Kount% = 8 then Exit Sub
End If
End Sub

:This sub is in a module and Kount% is passed to it from form14. The Label should appear on top of Text Box but it doesn't.
Sub Labull(Kount%)
Select Case Kount%
Case 1
Form14.Label9.Caption = "Enter Date Transaction Was Made...."
Case 2
Form14.Label9.Caption = "Enter Transaction Payee or Payor..."
Case 3
Form14.Label9.Caption = "Enter Transaction's Memo..........."
Case 4
Form14.Label9.Caption = "Enter Category Code if Used........"
Case 5
Form14.Label9.Caption = "Enter Amoumt of Transaction........"
Case 6
Form14.Label9.Caption = "Press Enter To Show Balance........"
Case Else
End Select
end sub
Ive written to text boxes with the same code but I see no reson this shouldn't work. Any idea's?

Label Caption Problem
I have a small problem. I have a few textboxses and a label`s on a form.
I also have database with names. Each name has it`s own number like ID. I would like to insert ID into a text box, press enter and the label caption would show me name fot that ID. And all this I would like to save to another database.
Thank you for your help!

Colors In A Label Caption
I want to change the color of a label, based on acode in the database. The help files don't help. I tried

if rs!Status= "A" then
label.Caption = QBColor(4)
end if

I also tried using the RGB to no avail.

Any suggestions?

Rotating Label Caption
I know this is going to be something simple, but I can't for the life of me seem to figure out how to do this...

I want to have a label caption rotate every 5 seconds.

Label1.Caption = "Hello"
Wait 5000
Label1.Caption = "How are you?"
Wait 5000
Label1.Caption = "What a lovely day outside!"
Wait 5000
(Somehow rotate back to the top, first caption)

How do I do it?

Label Caption Allign
I have a Label1

I want to place text in it, in the center.

Default it alligns text to the left. How to make it that it will allign from the center?

Thats all

Label Caption Color?
I did something that I cant undo, all the captions on all my labels on all forms turned to blue and my option buttons all have black surrounding them?

Label Caption Problem
I am not able to figure out why my label is misbehaving on me but I have a large chunk of text that is placed within the Caption property and it should keep that text within the labels visible area but it stays on one line and then it gets cut off without going to a new line automatically. i have checked my other labels and the properties are exactly the same, but this label is not cooperating. Any suggestions?

Label Caption Problem
I have a label: lblvat

When the price changes in other labels on the form, the lblvat.caption changes to display the VAT price.

But it keeps displaying it to 3 decimal places, despite me changing the dataformat property to currency with 2 decimal places.

Can anyone help?

Label Caption Won't Wrap
VB6 on WinXP

I have label controls that have wordwrap set to true, autosize set to false and are linked to a database with datasource & datafield. The problem I have is that the label captions are not wrapping automatically. Is this because they are linked?

Label.caption Changes Only When Stepping Thru.
I have two forms, one is all labels that can't be edited, the other is all textboxes and will open if you need to edit some of the info on the first form. If I edit the info, then hit the save button, the labels back on the first form are set to what ever is in the textboxes on the second form. If I run the program and make changes, they DO NOT show on the first form. If I step through the program and make changes, they DO show on the first form. Any ideas why?

Label Caption Problem

In my app I have a button that the user pushes to update a database over the web.
While the update is in progress there is a label that is supposed to flash "Updating Database".
Before the update begins I have a msgbox that pops up and verifies that the DB info is correct.
If I place the code for the label in front of the msgbox code it works as advertised. If I put it after the msgbox code it doesn't work. This would not be a real problem except that if it's in front of the msgbox code the update page displays the flashing "Updating Database" message. This causes some confusion with users that think the update is happening. But untill they click on the msgbox message to confirm the info no updating takes place.

Why does this code fail to work if it comes after a msgbox? I also get the same behavior from a progress bar Which is what I started with and got rid of in favor of the label approach thinking it was a Pbar problem.

Also the code to change the mouse pointer does the same thing(works b4 not after).

It works this way:

Dim RetVal As Integer

lblUpdating.Caption = "Updating Database"

Screen.MousePointer = vbHourglass

RetVal = MsgBox("You currently have " & BiddingGroup & _
" selected as your bidding group." & vbCrLf & _
"Is this correct?", vbYesNoCancel)
If RetVal = 7 Then
MsgBox "Select your bidding group and try again."
Unload Me
Set frmDownload = Nothing
Exit Sub
ElseIf RetVal = 2 Then
Unload Me
Set frmDownload = Nothing
Exit Sub
End If

It doesn't work this way:

Dim RetVal As Integer

RetVal = MsgBox("You currently have " & HomeGroup & _
" selected as your home group." & vbCrLf & _
"Is this correct?", vbYesNoCancel)
If RetVal = 7 Then
MsgBox "Select your bidding group and try again."
Unload Me
Set frmDownload = Nothing
Exit Sub
ElseIf RetVal = 2 Then
Unload Me
Set frmDownload = Nothing
Exit Sub
End If

lblUpdating.Caption = "Updating Database"

Screen.MousePointer = vbHourglass



How Can I Have Vertical Caption In Label

i want a vertical caption for label. plz can anyone help me, also i want to know how can a create a data report using form's textbox values(my text box values does not go to database) instead i want to print textbox value in data report.

plz help

Formating The Caption Of A Label
Is there away to format the caption of a label as follows.

I want to be able to put commas in a label that contains only numeric data. There is no text at all. Right now the label look like this "1000000" I would like to change it so it looks like this "1,000,000"


Ken Devorak

Label.caption To Clipboard
Please don't call me stupid but how do i copy the caption of a label to the windows clipboard??

Thnx in AdvaNCe

Checking A Label Caption

I have 1 of 2 Questions.

1 . how would i go about checking weather certain caracters is in a label's caption.?

I dont know (well ) this code doesnt function properly

For i = 1 To Len(LblGuess.Caption)
If UCase(TxtGuess.Text) = UCase(Mid(LblGuessed.Caption, i, 1)) Then

MsgBox "You already Guessed " & Chr(TxtGuess.Text)

TxtGuess.Text = ""
Exit Sub
End If

Is part of a hangman proggie im withing

Update Label Caption
Hi everyone,

How can I force VB to update the label caption, cause when i start my program it's to busy to update it during the process so it only updates the caption at the end of the process.

I hope you know what I mean, cause I can't come up with a better explenation right now.



Adding To A Caption In A Label Box
Hi Guys
I have a label box that displays the Caption "Please wait......"
I change this caption at various places using

Label1.caption = "Timer in Progress....".

Is it possible to add to the caption and add a line break instead of changing it. for example, I want the label box to display my progress at certain times in the following format. eg

Please wait...........
Timer in progress.....
Payment 1 processed...
Payment 2 processed ..
Payment 3 processed...

Thanks a lot for any help.
Kind Regards

Highlight Label Caption
Hi everybody
can anyone tell me if it is possible to highlight certain words in a different font colour when you assign a caption to a label at runtime ?

Updating A Label Caption In VB 6
Hi, I have the following problem - i am trying to find a solution to being able to implement the following action within my program - i am using the following code:

Private Sub Form_Load()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset

cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:DevelopmentAddress BookAddressData.mdb"
rs.Open "SELECT * FROM Addresses", cn, adOpenStatic, adLockOptimistic

Set DataCombo1.RowSource = rs
DataCombo1.ListField = "FirstName"

End Sub

I am wanting to make it so that when a new name is selected from the Datacombo Box at runtime the label on the form is updated with another field from the access database file. I believe this is called binding the controls at runtime - can someone please help?

Thanks in advance,

Show & In Label Caption
I have a Form to enter names and Address

The TEXTBOX accepts and shows and entry thus

    MR & MRS Able Baker

A LABEL used to display Correspondance Salute SHOULD SHOW

    DEAR MR & MRS Able Baker

but the & is Replaced with an Underscore and displays as

    DEAR MR _ MRS Able Baker

BOTH TEXTBOX and LABEL are Ms Sans Serif bold 12

Can anybody help me with how to make Label show the & not the Underscore !!!!!

Label.caption Is Missing
Hello !

I am displaying some set of values in my 3rd form, which i am taking from my 1st form. Now i got error that ".caption" method is not found in this line..... Label1.Caption = CSng(form1.combo1.Text)

so i deleted everything and i wrote label1. ----------------- then i got one box in which i was seeing for caption but there was not caption option ..... so what will i do .... weher is problem......


- Label.caption = .txt From An Outside Server
Hello, Again!

How would I go about changing a label's caption by what the contents of a .txt on a website is?

Edited by - Do the hokey pokey on 8/24/2004 10:16:38 AM

Copyright 2005-08, All rights reserved