|
-
Aug 10th, 2016, 06:03 PM
#1
Thread Starter
Lively Member
-
Aug 11th, 2016, 04:46 AM
#2
Re: Highlight Text by command click or in list index
To highlight a piece of text in a TextBox use the .SelStart and .SelLenght properties
You can't highlight pieces of a text in a Label control
-
Aug 11th, 2016, 12:18 PM
#3
Thread Starter
Lively Member
Re: Highlight Text by command click or in list index
Many Thanks Dear #Arnoutdy !
-
Aug 11th, 2016, 04:38 PM
#4
Lively Member
Re: Highlight Text by command click or in list index
You can highlight whole or part of any text in a label
-
Feb 5th, 2017, 03:25 PM
#5
Thread Starter
Lively Member
Re: Highlight Text by command click or in list index
I found something easy
---------------
If List1.ListIndex = 0 Then
With Label1
.Visible = True
.Width = 3000
.Height = 1500
.Left = 2100
.Top = 60
End With
Label2.Visible = False
ElseIf List1.ListIndex = 1 Then
With Label2
.Visible = True
.Width = 3000
.Height = 1500
.Left = 2100
.Top = 60
End With
Label1.Visible = False
End If
End Sub
------------------
-
Feb 5th, 2017, 03:46 PM
#6
Re: Highlight Text by command click or in list index
 Originally Posted by On Error Try Again
You can highlight whole or part of any text in a label
Example please......
-
Feb 6th, 2017, 11:00 AM
#7
Thread Starter
Lively Member
Re: Highlight Text by command click or in list index
Private Sub List1_Click()
On Error Resume Next
If List1.ListIndex = 0 Then
With Label1
.Visible = True
.Width = 3000
.Height = 1500
.Left = 2100
.Top = 60
End With
Text1.Text = "Bleeding time is a laboratory test to assess platelet function and the body’s ability to form a clot. The test involves making a puncture wound in a superficial area of the skin and monitoring "
Text1.SetFocus
Text1.SelStart = 14
Text1.SelLength = Len(Text1.Text) - 122
Label2.Visible = False
ElseIf List1.ListIndex = 1 Then
With Label2
.Visible = True
.Width = 3000
.Height = 1500
.Left = 2100
.Top = 60
End With
Text1.Text = "Bleeding time is a laboratory test to assess platelet function and the body’s ability to form a clot. The test involves making a puncture wound in a superficial area of the skin and monitoring "
Text1.SetFocus
Text1.SelStart = 85
Text1.SelLength = Len(Text1.Text) - 118
Label1.Visible = False
End If
End Sub
-
Feb 6th, 2017, 06:40 PM
#8
Re: Highlight Text by command click or in list index
So, MKP, how does your code highlight part of the caption (you called it text) of a label. Your code does nothing except sets basic stuff for your labels, but does nothing with their captions.
Still waiting on "On Error Try Again"'s answer to my question in post #6.
-
Feb 7th, 2017, 11:18 AM
#9
Thread Starter
Lively Member
Re: Highlight Text by command click or in list index
when you click (listIndex=0) text1 will foucs a part of text not all of text and highlights that part, and when you click (listIndex=1) it will select and highlight another part.
-
Feb 7th, 2017, 07:06 PM
#10
Re: Highlight Text by command click or in list index
BUT NOT LABELS! At least YOUR code doesn't highlight a portion of the text (.caption) of your labels.
So, never mind, guess I have no idea what you are trying to do with labels anyway...adios.
-
Feb 8th, 2017, 10:55 AM
#11
Thread Starter
Lively Member
Re: Highlight Text by command click or in list index
Yes, I tried to highlight a part of label, but i couldn't do it.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|