One Sub Procedure / Change Text Color In Rich Text Box / Without Button Handler?

Oct 8, 2010

everyone! I've been at this for a while, and I'm not sure how this issue can be resolved:I'm working on a project in VB.Net, and I have a form with a rich text box. I have a groupbox with 4 radio buttons inside that are intended to change the font color of the text. Coincidentally, I have to repeat this same functionality for a 2nd set of radio buttons that would change the text font family.

At any rate what I've only been able to do is the following to successfully change the font color of whatever text I highlight in the rich text box:

Private Sub rbtnBlack_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnBlack.CheckedChanged
rtbxTextEditor.SelectionColor = Color.Black
End Sub
Private Sub rbtnRed_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnRed.CheckedChanged

[Code]...

Is there a way that I could write a sub (I'm assuming I would use a sub, since I don't think I need to return anything, thus eliminating the use of a function) that would handle the action of changing the selected text color in the rich text box without having to use a separate sub for each radio button? Mind you, per my teacher's specs, she doesn't use a button handler for any of this.

View 1 Replies


ADVERTISEMENT

Change Text's Color In Rich Text Box?

Oct 20, 2010

How can I change certain text's color (like Visual Studio does with "Public Class" or "Public Sub") is inside of a Rich Text Box?

View 14 Replies

Change Color Of Different Lines On A Rich Text Box?

Mar 21, 2012

I'm creating a program that pings a host. I'm trying make text appear RED on one line if it's down, and GREEN if it's UP.

View 6 Replies

Change Color Of Text In A Rich Textbox?

Jul 24, 2010

[code...

When I use this code I get the error "Property 'Chars' is 'ReadOnly'."

View 9 Replies

Make First 60 Characters In A Rich Text Box A Different Color Than The Remaining Text?

Feb 7, 2009

is it possible to make first 60 characters in a rich text box a different color than the remaining text?

View 25 Replies

Tabbed Rich Text Box Text Color?

Apr 9, 2011

So I've tried a few different things I though may work, and none of them do. I can't figure out how to change the color of the text within the selected rich text box inside a tab control.

View 1 Replies

Text Color In Rich Text Box?

Nov 5, 2009

I can find a million examples of doing reg ex to apply syntax highlighting to a rich text box. but what i need it just a simple way to add in a word of a diffrent color.

What would the code be to just put the words "Hello World" into a textbox and have Hello be red and World be green?This code doesnt work.

this.richTextBox1.SelectionColor = Color.Red this.richTextBox1.text += "Test"

View 3 Replies

Rich Text Box Font Color?

Apr 9, 2009

I have a program that checks for the color under the mouse pointer. I also stores what I think is the RGB (could someone confirm this?) value for that color in a Rich text box and next to that in a text box the coordinates of the mouse at that time.The idea is to be able to measure the times between the bounces of a tennis ball in a video. The background is black and the tennis ball is another color.I wasnt sure how to say "if color is not similar to black... Do this"So my plan was to set the richtextbox font color to itself - as it is an RGB value. But thats difficult, it wants to change ALL the text in the RichTextBox, not just the current Value.Basically Ideally I would like it if it recorded the times between significant changes in color of the pixel and displayed them.

View 1 Replies

Rich Text Box Fore Color?

Aug 28, 2010

How to set fore colors in text addition in Rich Text Boxes?

View 5 Replies

VS 2008 - Rich Text Box - Cannot Change Only Text

Aug 5, 2009

I have a rich text box and a fontDialog control. I am using it for the obvious purpose of changing the font of the text in the rtb, which I can do. What I would like to know is how, if there is no text selected inside the rtb, to make it only change the text that is typed after the change. I have already made it so that a selection can be changed independently but cannot make it change only text that is going to be typed if there is nothing selected.

View 1 Replies

Rich Text Box To Automatically Change

Dec 23, 2011

i just started learning visual basic and i need some information i am using rich test box to input some text say like"RED BLUE GREEN" i want the Rich text box to automatically change

[Code]...

View 5 Replies

Unable To Load Rich Text Files Into Rich Text Box?

Jan 12, 2009

I am unable to load rich text files into my rich text box. It worked fine yesterday, would there have been anything I could have changed by accident?

With OpenFileDialog
.Filter = "Text format (*.txt)|*.txt|Rich Text Format (*.rtf)|*.rtf|All files (*.*)|*.*"

[Code]...

but I am getting the error File format is not valid when i attempt to open any Rich Text file

View 4 Replies

Change The Fore Color Of Text In Text Box?

Mar 6, 2012

Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles ColorToolStripMenuItem.Click

[Code]....

Will not allow me to change the fore color of my text in my text box

View 5 Replies

Use A Controlbox To Change Text Color In Text Box In 6.0?

Apr 21, 2010

How to use a controlbox to change the text color in a text box in visual basic 6.0?

View 3 Replies

Rich Text Box - Load Specific Text In The Rich Text Box When The User Load The Form?

Apr 4, 2010

I have a rich text box which I use in order the user is able to add pictures, coloured writing, different font etc... however I need to load specific text in the rich text box when the user load the Form.how I can add (I guess) the HTML to load this every time the user load the form.

P.S the text will change depending on who loads the form so I can not do a simple

RichTextBox1.LoadFile("C:Documents and SettingsDesktopSigniture.rtf")

View 2 Replies

Change Item Text Color Or Background Color In ListBox In .NET 1.1

Jun 17, 2009

I am using .NET 1.1, so I don't have the access to listitem object. I would like to change the text color or the background color of certain items in a listbox. can it do it in .NET 1.1?

View 5 Replies

Create Rich Text Box By Button Click?

Apr 15, 2012

I'm a noob to the .net world and I was wondering how I would go about creating a rich text box by triggering a click event button. I am trying to shrink the data currently in my form. One way of doing this would be to take away the two rich text boxes I have drag/dropped into the form and just adding a button. When the button is clicked, a rich text box will pop up.

View 1 Replies

Format Text - Rich Text Box - Where The User Will Be Entering Information - The Text Is Black

Aug 11, 2011

On the main form of my application, I have a Rich Text Box which is where the user will be entering information. The text is black. then, i have a button which calls the dialogue "Notes" A dialogue appears, with a rich text box. the user should then be able to enter text into the box, click "OK", and the text entered into the Notes dialogue be inserted to the rich text box on the main form -- with the font colour "Red". The rest of the text in the main rich text box on the main form should remain black.

View 2 Replies

VS 2010 - Rich Text Box - Getting User Text In The Text Changed Event

Jan 20, 2011

I'm Making a Simple syntax highlighter and I'm Doing the highlighting in the text Changed event of a RTB and for obvious reasons I can't re highlight the whole document each time someone presses a key so i highlight one line each time the text changes. But this creates a Problem. If someone pastes code into the RichTextBox It only highlights the last Line. So is there a way to get if the user typed the text in with his keyboard or pasted it from the clipboard in the text Changed event?

View 6 Replies

Making Font Bold Using Button Controls In A Rich Text Box

Aug 6, 2011

How can i make the Font Bold in a RTB using buttons?

View 2 Replies

Change Color In Rich Textbox?

Sep 30, 2010

I am trying to change color of a selectedtext in Rich TextBox.When user check color radio button it should change the color of the selected text.I have 4 radio buttons inside groupbox.Can someone tell me how do i select text and change color.Below is my code but its not working as expected.[code]....

View 6 Replies

VS 2010 Button To Toggle Between Bold/regular Font In A Rich Text Box

Oct 1, 2011

I have a rich text box ('RichTextBox1') and a button ('BoldButton'), and have it set up so that whenever the user highlights some text in the box and clicks the bold button, that text becomes bold. That much I've figured out...

Public Class Form1
Private Sub BoldButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BoldButton.Click
Dim Bold As New Font(RichTextBox1.Font, FontStyle.Bold)
RichTextBox1.SelectionFont = Bold
End Sub
End Class

But I'd also like to add the ability that if the user highlights text that is already bolded, then clicks the bold button, that text will go back to 'regular' font. In other words, I'd like the 'bold' button to be able to toggle between bold and regular font.

View 5 Replies

Change Text In Label.text With A Click Of A Button?

Jan 20, 2010

I have this problem but I already simplify the code as below:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Label1.Text = "hello"
System.Threading.Thread.Sleep(5000)
'MessageBox.Show("hahahaha")
Label1.Text = "world"
End Sub

What I'm trying to achieve here is, after I click the button, the label1.text should change to hello, and after that to world. But I couldn't achieve that. Instead when I click the button, it just paused for 5 second and displayed world.System.Threading.Thread.Sleep(5000) The code is just a dummy for a loop that I have.

View 6 Replies

Insert Text To Rich Text Field At Text Cursor?

Mar 28, 2010

I have a question, how would i have a button, then when you click it, it puts the text at the text cursor in the RTF?

View 5 Replies

Change Color Of Text?

May 26, 2008

I am new to visual basic and i'm having difficulty changing color of a text. I'm currently using visual studio 2008. My program is similar to a search engine in which you type a term inside the searchbox and the program will produce the results in a separate message box that will pop up. I would like for the search results in the message box to be changed to a different color.

View 6 Replies

How To Change Color Of Text

Aug 17, 2009

How can i change the color of the text in vb.net 2008 console?

View 3 Replies

How To Change Text Color

Dec 8, 2010

I am inserting COMMENTS and COMMAND from text box to rich text box,I want to change color of Comments to green and Commands to red and write it in rich text box.. But I am not able to convert the text color.

View 5 Replies

Change Color Of Text According To Answer?

Oct 10, 2010

This might be a basic question but I am just starting in VB. How can you change the color of the text of a form if a person selects they are a boy or girl. I want the text to be blue if they select boy and pink if they select girl.

View 2 Replies

Change Color Of Text In Code Behind?

Feb 11, 2012

I am newbie using asp.net I want to ask on how to change color of the label with some conditional statement. For e.g if the stock is below 20 then the label will became red if not then it's black.

View 1 Replies

Change Color Of The Text In RichTextBox

Apr 10, 2009

Trying to change the color of more than one of the same text within a RichTextBox. [Code] The above code searches for, and changes the color of all "Boat"s found in the RichTextBox. There are a few problems, such as: If you were to go back to edit the RichTextBox and place your cursor in front of the, now blue word, "Boat" and type then all of your text would be blue. Also, the text you wish to change the color of in the RichTextBox MUST be Exactly the same as: "Search1", aka "Boat", capital letters and all.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved