things you can do with a Rich Text Box
![Visual Basic 6, or VB Classic Visual Basic 6, or VB Classic](https://www.fortypoundhead.com//assets/img/icons/v7/vb6.png)
This Will Teach You How To Do Many Things With A RTB.
Original Author: Steven Dorman
Code
1.Have you ever wondered how to format etc. using RTB's?
In Visual basics, there is a control called a RichText Box
This RichText Box allows you to Syntax Color , change font color ,
change font size , as well as allowing text to be bold,italisized,underlined,have strikethrough,size,type
and MUCH more!
through out the tutorial we will refer to richtext boxes as " rtb " or "rtb's"
there will be a few sections , explaing how to do these things , along with some helpful info along the way.
2.Possible Uses...
there some possible uses for RTB's , like :
A html editor , the use could be syntax coloring.
a text editor ( like wordpad ) so you can use font types , colors and sizes
or just to make your programs look nicer!
3.the bare basic's ( bold etc )
First we will need to make the rtb.
to get one:
start a .exe project and :
press and hold ALT and then press p this will open the menu ,
now ( still holding alt ) press N , this will open the " refrences " menu.
scroll down the list untill you find some sort of thing says rich text box.select it and click ok.
for newbie programmers:
ALOT of functions and controls are not in the list to your left ,
to get more , simply repeat the previus selecting a diffrent one.
first thing : use that newfound rtb control and make a rtb on your form and name it rtb.
next i would create some sort of button etc. , name is cmdbold and attach this code to it:
if rtb.selbold = false then
rtb.selbold = true
else
rtb.selbold = false
end if
explanation:
rtb.selbold is the formation to make the rtb well bold
the if procedure checks to see if its bold , if it isnt turns it on , and vica verca ( i think i spelt taht wrong )
here are some other things you can do to change the formating in an rtb.
replace selbold with:
selitalic , this makes it italisized
selunderline , this makes it underlined
selstrikethru , this makes is striked ( cant do that one :P )
4.colors and sizes!
its the same structure for color and sizes
add a new button called cmdcolor , and add a commondialog control and name it cd.
attach this code to cmdcolor :
on error resume next
cd.showcolor
rtb.selcolor = cd.color
this simply opens a color dialog box and sets the rtb's color ( the line is rtb.selcolor = cd.color )
size is the same except this is all you need:
make a new button and name it cmdsizeto40 , then add this code to the button
on error resume next
rtb.selfontsize = 40
this simply sets the rtb size to 40!
thanx for reading this article , i will make it better , but i have to go.
visit my site CLICK HERE!
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.