Library tutorials & articles
Rich Text Box Controls
Introduction
There are many things the can be done with a rich text control. You can create a word processor that has multiple features including put bullets, automatic save & load, and being able to superscript & subscript. All of these and more will be shown in here.
Because most visual basic programmers already know the main functions of the
regular textbox, I'll skip that part of the rich textbox control. The main
function I use the rich textbox is to save and load files. The rich textbox
makes very simple to create save and load files. There are three parts to a rich
textbox, the textbox, the file path, and the file type. You don’t
need to specify the file type if the file path already contains it.
Save a file:
Object.Save (FilePath, FileType)
Load a file:
Object.Load (FilePath, FileType)
As you can see loading and saving are very similar and very simple.
This saves everything including text, color, and bullets. Next is
the different ways of editing the format.
Related articles
Related discussion
-
VB6 Runtime error 381 subsript out of range Error
by Uncle (2 replies)
-
passing and reading parameters from using Shell
by jigartoliya (0 replies)
-
Convert C++ code to VB6
by mawcot (4 replies)
-
listbox scrollbar
by Dennijr (10 replies)
-
Can you describe Above simple VB6 code?
by pramodmca09 (0 replies)
Related podcasts
-
Christian Beauclair
14 mai 2008 (�mission #0074) ::.Christian Beauclair: Stratégies de migration VB6 vers .NET Nous discutons avec Christian Beauclair des stratégies de migration VB6 vers .NET. Entre autres, nous discutons comment utiliser le "VB 6 Code Advisor" et le "Interop Forms Toolkit" pour ajouter la puiss...
hmm...anyone know how to code the button "aligement left" , so that when the button is clicked , the text in the richtextbox is align to the left...anyone can help? ~.^
!--removed tag-->hi redstar...
m also facing same problem.. do u got any solution?
with regards,
kailas
how to get arrow intendation
how to chane the bullet intend as arrow
I am wondering if thier is a way to save and load text formatting using VB6, for example fonts, text colors etc. Does anybody know any easy ways round it???
Try the following code as work around:
' flag the section with bullet mark
rtfSectionText.SelBullet = True
' replace bullet with numbers
rtfSectionText.SelRTF = Replace(rtfSectionText.SelRTF, "\pnlvlblt", "\pndec", 1, -1, vbTextCompare)
I found som rtf documentation on the Microsoft site:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnrtfspec/html/rtfspec_16.asp
Hope it helps
Bulleted indenting is fine.
But how to get number indentation?
Is there any way?
thank you
How to make subscripts and superscripts in DHTML editor using c#?
Hi,
I am having problems in sending selected text to a rich text box control without selecting the text at runtime e.g. at runtime the rich text box contains the text "Selection" and when a command button is pressed the following text in BOLD is appended to the current text "IS EASY"
Selection IS EASY
(I know that this cannot).
I use the rich text box and insert in it the mschart object, but i can not refer to mschart property and metods with OLEOBJECTS.
help me pleas, help.
0 = rtf
1 = text
Hi,
i am working with richtextbox quite a lot of time, but i am still wondering how can i input a picture in it. Also i have the point that i ignore some of his opportunities. So i would be glad if you could write something about them. Thank you on advance
Object.Save (FilePath, FileType)
WHAT FILETYPES? Can it save in RTF, Text, and what are the corresponding numbers?????????????
Secondly, I am sure that in EVERY rich text editor I have ever used, you can set different indents for different paragraphs. Yet you do not mension how to align a paragraph... "is just like setting the alignment for a whole textbox."
Aside from that it was pretty good, but can't you also do Horizontal Rules in Rich Text? I know no-one normally does, but if ya can . . .
Thanks for the info though, I was always confused about the select stuff.
Hello KillerSheep,
Is this what you're looking for:
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Option Explicit
Public Const WMUSER = &H400
Private Const EMSETTARGETDEVICE = (WM_USER + 72)
Public Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal LParam As Long) As Long
Public Enum ViewModes
Default = 0
WordWrap = 1
WYSIWYG = 2
End Enum
Const EMFORMATRANGE As Long = WMUSER + 57
'** Set View Mode
Public Sub SetViewMode(ByVal ViewMode As ViewModes)
Select Case ViewMode 'Set View Mode
Case 0 'No Wrap
SendMessageLong rtfText.hWnd, EMSETTARGETDEVICE, 0, 1
Case 1 'Word Wrap
SendMessageLong rtfText.hWnd, EMSETTARGETDEVICE, 0, 0
Case 2 'WYSIWYG
On Error Resume Next
SendMessageLong rtfText.hWnd, EM_SETTARGETDEVICE, Printer.hdc, Printer.Width
End Select
End Sub
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
By
Thanks a lot!
Now, where can I find the soln for this?
VB has no bulit in functions or constants for what you want, im not gonna be much help here sorry!
Not left, right or center.
Justified as in MS Word. ie, both left and right ends are aligned.
and one of the following;
for example;
RichTextBox1.SelAlignment = vbCenter
or
RichTextBox1.SelAlignment = vbLeftJustify
Hope thats some help;
Luke
When printing Rich Textbox text it seems to disregard the Current X/Y command. What gives>
Could you tell me how to display the text in Justified manner in a RT Box?
I've tried just about everything (other than writing a new control
Tx and Regards
one thing you forgot - How do you toggle line wrapping on and off?!
hee hee thanks
There is no option of
Richtextbox1.selprint(Printer.hdc) in vb.net that is only in VB6.
Thanks
'Prints the current document using the device
'handle of the current printer
RichTextBox1.SelPrint (Printer.hDC)
End Sub
This thread is for discussions of Rich Text Box Controls.