473,394 Members | 2,100 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Richtext box changing colours

Mague
137 100+
Hey,

I need to change colours in a richtextbox. I am making a simple html editor. i want to make the tags different colours. I have searched google so please dont say search google. I also use vb.net which makes it a bit harder to find anything

Open to any ideas but searching google.

ty
Mague

ps. Im a kid (13) Not to technicle thanks
Jul 3 '07 #1
3 1168
Mague
137 100+
I figured it out with this code

Expand|Select|Wrap|Line Numbers
  1.                RichTextBox1.SelectionStart = RichTextBox1.Find("<html>")
  2.         'using the Find method to find the text "are" and setting it's return
  3.         'property to SelectionStart which selects the text 
  4.         RichTextBox1.SelectionColor = Color.Blue
  5.         'setting the color for the selected text with SelectionColor property
  6.         RichTextBox1.SelectionStart = RichTextBox1.Find("<body>")
  7.         RichTextBox1.SelectionColor = Color.Yellow
  8.  
i have tried but i cannot make it select the text that the user was previeously on
Jul 4 '07 #2
Killer42
8,435 Expert 8TB
Glad to see you got it sorted out. See, being 13 is no handicap. You were much too quick for us. :)
Jul 4 '07 #3
Mague
137 100+
I just relized a problem. Everytime text is put into the richtextbox it has to go through a few tags. And if you writing html codes it get really really really anoying. Is there anyway that i can make it only update things that have not been updated. (Meaning change the colours only if the colour hasnt been changed)

Also it is a bit of a handycap because you cannot buy software or anything :)

ty alot
mague
Jul 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: david.graham18 | last post by:
Hi I spotted some nice code to change the background colour of a web page to one of four different colours at random but I can't find it now! The method was to select a number at random from 1...
0
by: Lukas Thanei | last post by:
Hi, Im trying for 2 days to solve a problem but now Im on a point where all ideas exhausted. Im writing a software to print out some cards containing richtext and images. To print the...
2
by: Du | last post by:
I like richtext textbox and its shortcut, but I don't need the richtext format. How do I tell the richtext text box to strips all the format and convert everything to plain text? Thanks
0
by: mheys | last post by:
Trying to use richtext box to emulate email address textbox entry of outlook. I want to have multiple items in the text box separated w/ ';' and only valid items underlined. I have been able to...
2
by: Gary Shell | last post by:
I have a very ODD situation. I have a RichTextBox and a button. In the button click event I have the following: me.richtextbox1.SelectedText="test" Assuming I start with "aaaabbbbcccc" in...
3
by: rigamonk | last post by:
Is there a way to save richtext from a richtextbox into an access DB using vb.net? thanks patrick
11
by: Hugh Janus | last post by:
OK, this is driving me crazy! As far as I can tell it should work. It compiles fine. I am saving the fore and back colour of a RTB to the registry like this: Srx.SetValue("ForeColour",...
0
by: giddy | last post by:
hi , i made a little RtfEncapsulator. Its a class thats called RichText , it has an RtfElementCollection which takes any class that exposes the IRtfElement interface. I managed to make an...
7
by: emlimeng | last post by:
Hello, I have a label on the form to draw people's attention so they do not forget to input the data in a particular section. e.g. "Please carefully check all the options on the form". I hope I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.