473,799 Members | 3,080 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Richtext box changing colours

Mague
137 New Member
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 1194
Mague
137 New Member
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 Recognized Expert Expert
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 New Member
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
1971
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 to 4 by using the rnd() function and then dividing by modulus 4. The result was then used to select a cell in a 4 cell array which was holding a different colour in each cell of the array. I would like to have this code but lack the knowledge to...
0
1194
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 richtext im using an windows api call (Sendmessage EM_FORMATRANGE - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_RichTextBox.asp). Because I have to print background images, the richtext background should be
2
4615
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
1179
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 accomplish all of that. However, what i can't seem to do is prevent the user from typing over or changing an underlined item. In Outlook, the user is prevented from changing the underlined text. They can delete it, but not change it. I am...
2
2374
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 the richtext box and I place the caret between the a and b and hit the button. I get "aaaatestbbbbcccc" as expected. Then I click between the b and the c and hit the button I get:
3
2043
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
2495
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", Console.ForeColor.ToArgb.ToString) Srx.SetValue("BackColour", Console.BackColor.ToArgb.ToString) Then, I try to read the colours back in at runtime and change the
0
1168
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 RtfTextElement which works really well. So to add text this has to be done: Code:
7
7418
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 can automate the colour of the label, so that the colours for the label can keep on changing nicely and smoothly from one end to the other. Such as the colours moves per letter or per word from left to right towards the end of the sentence, or from a...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.