Changing Color Of A Line Of Text In Textbox
I have a file being loaded into a textbox and I would like to know how to change the color of certain lines of text. like the VB IDE does with the comment lines. i have an idea but I am unsure where to start. do I start after it loads into the box or before? if you need the code that loads it in the box let me know I would post it.
thanks for your help
Scoutt
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Changing The Color Of One Line In A RTF Textbox
I am using a RTF textbox to display a list of items. The program loads these items one at a time as it goes down the list. I would like to be able to highlight or at least change the color of an item as the program loads it one at a time, changing it back to the plain black color before moving to the next item. Any ideas?
Ben
Changing The Color Of One Line In A RTF Textbox
I am using a RTF textbox to display a list of items. The program loads these items one at a time as it goes down the list. I would like to be able to highlight or at least change the color of an item as the program loads it one at a time, changing it back to the plain black color before moving to the next item. Any ideas?
Ben
Changing Richtextbox Text Color By Line #
Is there a way to change the text color in a richtextbox by the line number?
I would like for text to highlight within the RTB without user intervention.
Thanks for any help
Changing Textbox Text Font Type/Size, Bold, Italic, Underline And Color
Hi everyone, this is urgent.
I have a textbox where user can type in there. When user select (highlight) the text they can change the font, size, Bold, Italic, Underline and/or color. It should work like in MS Word.
How do I do this? I have a combo box for Fonts, a combo box for Size, and 4 command buttons for B, I, U, and Color.
Please help?
Thanks
Changing Text Color In An RTF Without Changing The Current Texts' Color
I need to add multiple lines of text to a Rich Text box, all with differnt colors.
Now if say, i have an line of text colored orange, and i add a line of text colored as red, the orange line becomes black (default) and the last line is red.
I need to keep the orange line orange, while the new line red
i will attach the code of the test example i wrote:
You will need to add the Microsoft Rich Text Box v6
Here is the code i did in the command button (Command1)
Code:
With RTB
.Text = .Text & Text1
.SelStart = Len(.Text) - Len(Text1)
.SelLength = Len(Text1)
.SelColor = Val(Text2)
End With
The form contains a rich text box (RTB) a text box where you input the text to be added (Text1) another text box where you enter the color of the new text (Text2) and the command button to add (Command1)
Changing Color Of The The Highlight Color And Highlighted Text Color
does someone know of a snippet where it shows how to change the color of the hightlight bar/color and the highlighted text,i am doing something in a rtb and i hate when colors are bouncing all over when highlighting it and wanna set two main colors for highlighting but cant seem to find a snippet
Changing Background Color Erase The Line Of Picturebox
I run the below code and the problem is that the line disappeared after change the background color of picturebox.
Code:
Picture1.Line (50, 50)-(200, 200)
Picture1.BackColor = QBColor(2)
How to change background color after draw line at run time without erase the line?
Changing Textbox Color With Focus
Does anyone know how to change a textbox and font color without placing it in it's own Sub?
This is what I am trying to accomplish:
When a user sets focus on a text box the backcolor changes and font color changes. Once the focus is lost the textbox reverts back to white and the font to black.
Here is what I have so far:
Private Sub Text1_GotFocus()
Text1.BackColor = vbYellow ' Changes text box to yellow
Text1.ForeColor = vbRed ' Changes font to red
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = vbWhite 'Changes text box back to white after losing focus
Text1.ForeColor = vbBlack 'Changes font back to black after losing focus
End Sub
My question is: Is there anyway easier to do this? I have many text boxes per form.
TIA
Changing Line Color Of Crystal Report Chart Object
Hi,
The following problems encountered while plotting the line graph in crystal report.
Dev Environment: Visual Basic .NET 2003
Graph object used: Crystal report chart
Pb1) I want to change the line colors in plots. There are five to six variables in my graph. The object assigns random colors to the line. Many times two lines are drawn by same color. How do I change the line color in chart object?
Pb2) In the same chart I want to change the legend names. As per "ReleaseNotes.Doc" document this problem is fixed in crystal report Ver 9.0("ReleaseNotes.DocADAPT 13986"). I am using the "9.1.5000.0" version. (This is what it shows on all crystal report dlls). How do I change the legend names?
Thanks in advance for the information you will provide.
Regards,
Ani
Changing Background Color For Textbox When Clicked On???
OK, I'm new to VB.Net. I'm trying to figure out the code to change the background color of a textbox when it's clicked on. For instance, if I have a textbox in a form and it's intially grey. I want the background of the textbox to turn red when it's clicked on. How do I set this up?
Any help would be greatly appreciated.
Thanks.
Changing The Font Color Of A Rich Textbox
Hi,
how can I change the font color of a rich textbox? I've tried looking for "forecolor" option but there's none...
Thanks...
Edited by - gen23 on 5/6/2004 10:44:28 PM
Changing Enabled = False Textbox Font Color
i am new to visual basic.
i have set a textbox's enabled properties to false.
the text color in the textbox appear to be grayish, although i have tried to change the forecolor to black.
is there anyway i can get back the font appearing in that textbook to be in black color even after i disabled it?
Changing The Color Of Text
I want to make a C++ editor in Visual Basic. Ha, I don't even know how to change the color of the words in the box when the enter a key word in. Does anyone know how I could do this?
grayknight
Text Color Changing
How would I change only certain parts of the text in an RTB and what is the command for changing the colors?
Text Color Changing
I have a strings that are in a RTB. I would like them highlighted in a blue color when the user presses a command button leaving all other text black. What code would I use to do this?
Changing An RTB Text Color
i have a friend who says
VB Code:
RTB1.SelColor = vbRed
is how you change the RTB Font Color....but it doesnt seem to work so can someone tell me the proper way to change the RTB Text Color Please ill really aprreciate it
Changing Text Color
how can i change the color of the text so when it sends it it is red but i just want that part of the text red or green or whatever i choose not the whole textbox? thanx
Changing Color Of The Text
ok! here's is my question:
I have a textbox and I would like to have some words
of the text in one color and some other words with a different color..........how can I do this.
Thanks
Changing Text Color On The Fly
I have a rich text box that a whole bunch of text gets poured into, I want this text box to check to see if the word "private" is typed in, if it is I want it changed to blue. Any idea how to do this?
Changing Text Color
Hey what's up guys.
I have a textbox with the text color set to black. However, if the user clicks on a certain button, I want to make all text that's entered after the button was clicked to be red. How can I do this? Right now, I can get the text color to change but it ends up changing all of the text in the textbox, not just the text entered after the user clicked the button. So if anyone knows how to fix this, I'd appreciate it. thanks.
-Goalie35
Changing Text Color
i want to change the text color of a tree control as soon as i hover mouse on the text can you please guide me how to make it.
Anu
Changing The Text Color
Hello All,
How can I change the caption text color on a button. I would appreciate any help.
Thanx in advance
How To Force New Line Of Text In A Multi Line Textbox
For example, i want to print in vb like this
1. one
2. two
in c , i can do something like
printf("1. one
");
printf("2. two
");
If I need to display the same text in a VB textbox control, i must force a new line too. How could i do it in VB? Any help would be appreciated thanks in advance..
Changing Text Color In Mid-sentence
I'm still working on my chat program, and I got it running but have a slight issure that drives me crazy.
I need to find out how I can change the text color in mid-sentence.
For Example:
AOL Instant messenger uses a text color system when sending messages
If bob102 sends a message , it comes onto the screen like
[red]bob102: [normal] message
If somone could let me know how exactly to do this I would be very appreciative. Thanks
-Mitas
Changing The Color Of Task Text
I have the following code (thanks to help from another thread!)
Code:
Sub TimeStamp()
Dim myOlApp
Dim myItem
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
myItem.Body = myItem.Body
myItem.Body = "Last update: " & Format(Date, "mmm dd yyyy") & " - " & Format(Time, "hh:mm am/pm") & vbCrLf & myItem.Body
SendKeys "{END}"
End Sub
I have two questions:
1. How can I set the color of the time and date text that I'm adding to the task? I'd like it to be say, red. This has to be easy, but I don't know VB very well.
2. I am still getting a dialog that says it wants access to my addresses. I learned from the VB help file that this is because I'm modifying a task but I haven't been able to determine if there is a way to avoid the dialog and it is very annoying.
Regards
Changing Color Of Text Within A Macro
I am writing a macro and am taking data from a few different sources and putting them all into one. I would like to color code the data so it is easy to tell which source it is coming from. Could somebody please help me out with a little sample code. I am looking for some code to change the color of the text in specified cells.
Thanks
Rich Text Box Changing Color
Hi people! I have problems with RichTextBox Control.
My app runs a process and i have a richtextbox control to show information about the process being executed.
I have a
I have this sub "Informar" to write text to the richtextbox control and its parameters are :
Text to print to richtextbox, Forecolor for that specific text i have as a parameter, Fontname, FontSize and FontBold. (I pasted code below)
The problem it doesnt change forecolor nor fontsize ....
why? what am i doing wrong?
Code:
Private Sub Informar(ByVal sText As String, _
Optional ByVal cForeColor As OLE_COLOR = vbBlack, _
Optional ByVal sFontName As String = "Tahoma", _
Optional ByVal iFontSize As Integer = 8, _
Optional ByVal bFontBold As Boolean = False)
Dim iStart As Integer, iLen As Integer
With RichTextBox1
.Text = .Text & sText
iLen = Len(sText)
iStart = Len(.Text) - iLen
If iStart > 0 Then
.SelStart = iStart + 1
Else
.SelStart = 0
End If
.SelLength = (iLen + 1)
.SelFontName = sFontName
.SelFontSize = iFontSize
.SelColor = cForeColor
.SelBold = bFontBold
End With
End Sub
Private Sub Command1_Click()
RichTextBox1.Text = vbNullString
Informar "Información...", vbBlack
Informar vbCrLf & " D ", vbGreen, "Wingdings", 30, True
Informar " No se han encontrado tarjetas a procesar!", vbGreen, True
End Sub
Sorry my english and thanks in advanced!
Changing Text Color In Statusbar
Hi,
I have a status bar called statusbar1.
in the first panel i have this:
USER - <currentUser>
where <currentUser> is a variable that contains a string.
How do i make it so USER is in black forecolor, and my variable is in red?
Thanks
oh, also i had another question. Totally unrelated but it's better than reposting i guess.
How do i eliminate the quotes when i insert a string variable into my sequential file?
when i do this i get quotes around everything in the file.
OPEN "log.txt" FOR OUTPUT AS #1
WRITE #1,currentUser
CLOSE#1
currentUser contains a string.
Thanks again!
Changing Color Of Caret In Text Box
This is probably a pretty easy one for the API savvy:
Anyone know how to change the color of the carat in a text box?
Reason I need this is that my textbox back color is the same as the caret and the user cannot see when the text box has focus.
Changing The Text Color In A RichText Box
Since the RichText box doesn't have a ForeColor property, how would someone go about changing the text color of one?
As always, thanks in advance for any and all help. Until next time, take care and God Bless!
-Tony
Changing Color Of Text Without Selecting It
This is my very first Visual Basic project besides the ones I've done in my "Learn Visual Basic in 21 days" book.
The idea is to create a program that can scan multiple very large text (.txt) files for a specific word. Very large meaning in the range of 100 MB each.
In version 1.0.0 I simply added each and every line from the files to a list box. This proved quite inefficient and caused my program to crash when dealing with very large files (though it worked splendidly with smaller ones). Now I just add each and every line to a Rich Text Box as I've heard they should able to deal with large amounts of data.
I want my program to make the search word bold and red in the Rich Text Box. With selStart and selLen it actually selects the word and then changes it which takes an incredibly amount of time. Is there a more efficient way to do this? My code for the search button looks like this:
(rtbOutput is the rich text box)
(the color changing part is the last part of the code)
VB Code:
Private Sub cmdSearch_Click()Dim i As Integer 'Number used to determine the position of the search word in the text boxDim strword As String 'The search wordDim strLine As String 'The text in the lineDim intFreeFile As IntegerDim intLineNum As Integer 'For linenumber in text fileDim intMatchCount As Integer 'The number of matchesDim intResponse As Integer 'For msgbox() answerDim strFileName As String 'String that holds the path of a file if only one file is openedDim strArrayFileName() As String 'Holds the path of multiple files if more than one were selected.'strArrayFileName(0) is the directory name and each subsequent string holds a filenameDim intFileNum As Integer 'The number of files the routine has to searchOn Error GoTo SearchErrorHandlercomFile.Filter = "Text Files (*.txt)|*.txt"comFile.Flags = cdlOFNAllowMultiselect + cdlOFNExplorercomFile.ShowOpenintFreeFile = FreeFilestrFileName = comFile.FileNamestrArrayFileName = Split(strFileName, Chr(0)) 'Chr(0) is the ASCII code for a null valuestrword = InputBox("Type the word you wish to search for in the text file(s)", "Search Word")If (strword <> Empty) ThenintLineNum = 0intMatchCount = 0 If UBound(strArrayFileName) > 0 Then For intFileNum = LBound(strArrayFileName) + 1 To UBound(strArrayFileName) rtbOutput.Text = rtbOutput.Text & "***************************************" rtbOutput.Text = rtbOutput.Text & Chr(10) & strArrayFileName(0) & "" & strArrayFileName(intFileNum) & Chr(10) 'Chr(10) is the ASCII code for a new line rtbOutput.Text = rtbOutput.Text & "***************************************" & Chr(10) Open strArrayFileName(intFileNum) For Input As #intFreeFile Do Until EOF(intFreeFile) intLineNum = intLineNum + 1 Line Input #intFreeFile, strLine If InStr(LCase(strLine), "" & LCase(strword)) > 0 Then rtbOutput.Text = rtbOutput.Text & intLineNum & ": " & strLine & Chr(10) intMatchCount = intMatchCount + 1 End If Loop intFreeFile = FreeFile intLineNum = 0 Next intFileNum Else rtbOutput.Text = rtbOutput.Text & "***************************************" rtbOutput.Text = rtbOutput.Text & Chr(10) & strArrayFileName(0) & Chr(10) rtbOutput.Text = rtbOutput.Text & "***************************************" & Chr(10) Open strFileName For Input As #intFreeFile Do Until EOF(intFreeFile) intLineNum = intLineNum + 1 Line Input #intFreeFile, strLine If InStr(LCase(strLine), "" & LCase(strword)) > 0 Then rtbOutput.Text = rtbOutput.Text & intLineNum & ": " & strLine & Chr(10) intMatchCount = intMatchCount + 1 End If Loop End If intResponse = MsgBox("Found " & intMatchCount & " matches", vbOKOnly + vbInformation, "Matches")End IfCloseFor i = 1 To Len(rtbOutput.Text) If Mid(LCase(rtbOutput.Text), i, Len(strword)) = LCase(strword) Then rtbOutput.SelStart = i - 1 rtbOutput.SelLength = Len(strword) rtbOutput.SelBold = True rtbOutput.SelColor = vbRed i = i + 1 End IfNextSearchErrorHandler:CloseExit SubEnd Sub
I hope all that code made sense I know it's quite a lengthy code. Hope you can help
THanks on beforehand
/EDIT:
Oh yes I forgot one thing: How do I force the rich text box to never break lines into 2 lines? If it's a full line in the text file I want it to be a full line in the rich text box as well
Flashing/Color-Changing Text?
I'm writing a program that allows me to keep track of my finances, etc. There is a frame on the form with labels, which contain descriptions of bills I have to pay (i.e. "Car Payment"). I would like to make the text in these labels change color ("flash"), as a reminder, when the program is opened on/around the day that each particular bill is due. I use DatePart to get the current day, which should trigger the correct label to start "flashing".
How do I do this? I tried using a Timer and a For/Next to scroll through the colors for the text, but nothing happened. Also, I have a feeling that if I achieve what I want, the program will get stuck in a loop, endlessly running through the colors. Is there an ActiveX control which allows for this property?
-Jeff W.
Changing The Color Of A Text Box In Access VBA
If I have 3 textboxes on an Access form and one of them has a text property of 1 and a name property of txt1, another has a text property of 2 and a name property of txt2 and the 3rd one is blank and has a name property of Seat_no, what code to I need to write to change the BackColor property of textboxes txt1 and txt2 to Red if I enter 1, 2 into the blank textbox?
Problem Changing Text Color
Hey there
I want to know how can we change the color of a specific word in
a RTF box when the user is continously typing in the RTF box.
for ex:
In any programming language the keywords are always highligted
So can any one help me to solve this problem
Changing Text Color In A Rich Text Box
two fairly easy ones (hopefully!):
I want to change the text color in a rich text box any idea?
And:
For some reason the tab button makes the cursor disapear out of my rich text box, know how to fix this?
Anybody have any ideas?
Last Line Of Text In A Multi-line Textbox.
Hi! I've made this form with one multi-lline textbox which will show the process status in my application, which in this case is downloading records from a database. Anyway, everything works out fine including the progressbar. But what I want now is how to automatically scroll down to the last message displayed in the textbox. 'Coz what happens right now is that while new lines of text were added to the textbox, it doesn't go down to the last message added so you have to scroll down to the last message after the process has finished. Is ther any way to go to the last line of text displayed?
Highlighting Text Line By Line Using Textbox
Hi guys , can any one tell me what shld i add to mine program so that when an event occur , it will highlight the 1st line and then the 2nd line till the last line .
Note :
1)each time , 1 line will be selected .
2)I am using a textbox
Code:
//api used
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As String) As Long
Private Const EM_GETLINE = &HC4
Private Const EM_GETLINECOUNT = &HBA
Private Const EM_LINEINDEX = &HBB
Private Const EM_LINELENGTH = &HC1
Sub cmdsend_click()
lngCount = SendMessage(txtprog.hwnd, EM_GETLINECOUNT, 0, 0)
With txtprog
For i = 0 To lngCount - 1
lngLineIndex = SendMessage(.hwnd, EM_LINEINDEX, i, 0)
lngLength = SendMessage(.hwnd, EM_LINELENGTH, lngLineIndex, 0)
strBuffer = Space(lngLength)
Call SendMessageStr(.hwnd, EM_GETLINE, i, ByVal strBuffer)
Debug.Print "Line " & i + 1 & vbTab & strBuffer
Next
End With
End sub
Thanks in advance !
|