Coral
Success! Thanks a million.
This code works :
Do Until localRS.EOF
lEntries = lEntries + 1
ReDim Preserve m_lPos(lEntries), m_lLength(lEntries)
m_lPos(lEntries) = Len(rtfHelpInfo.Text) ' I tried using Find and Span
methods and these simply wouldn't find the inserted value
m_lLength(lEntries) = Len(localRS!Description)
rtfHelpInfo.Text = rtfHelpInfo.Text & localRS!Description & vbCrLf &
vbCrLf
rtfHelpInfo.Text = rtfHelpInfo.Text & localRS!Usage & vbCrLf & vbCrLf
localRS.MoveNext
Loop
' now do the highlighting
For iSub = 1 To UBound(m_lPos)
rtfHelpInfo.SelStart = m_lPos(iSub)
rtfHelpInfo.SelLength = m_lLength(iSub)
rtfHelpInfo.SelBold = True
Next
-----Original Message-----
From: Coral Johnson [mailto:coral.johnson@r...]
Sent: 25 September 2002 04:58
To: professional vb
Subject: [pro_vb] RE: Rich Text Boxes
Simon
I eventually got something like this working, like you, after considerable
experimentation. What happens is that when you append a string to the text
property, you lose all formatting. What I resorted to doing was creating an
array of locations to be formatted (ie start, length, formatting info), as I
loaded the rich text box. Then I went thru the array, to format each piece
of text after the rich text box was fully loaded.
Coral
>
> Subject: RE: Rich Text Boxes
> From: "Lester, Simon" <Simon.Lester@c...>
> Date: Tue, 24 Sep 2002 17:33:37 +0100
> X-Message-Number: 33
>
> Thanks Pete
>
> I've got code working like that (where the text appears on the screen, the
> user selects a part of it and then presses a "make bold" button
> etc and this
> all works fine. In another part of the system I load the text from a
> database description, usage fields) and want to set the
> description to bold
> as I load it ie programmatically rather than an end user
> mouseclick and this
> is what I can't make work and has driven me mad for several
> (wasted) hours!
>
> -----Original Message-----
> From: Peter N. Kipe [mailto:pkipe@c...]
> Sent: 24 September 2002 16:14
> To: professional vb
> Subject: [pro_vb] RE: Rich Text Boxes
>
>
> My code for toggling bold looks like this:
>
> rtbComments.SelBold = Not rtbComments.SelBold
>
> You need to be sure there's no other event that might be affecting your
> text -- like SelChange.
>
> Pete
>
> -----Original Message-----
> From: Lester, Simon [mailto:Simon.Lester@c...]
> Sent: Tuesday, September 24, 2002 11:01 AM
> To: professional vb
> Subject: [pro_vb] Rich Text Boxes
>
>
> Hi
>
> I'm working with richtext boxes in VB6 and want to achieve a mixed
> bold/regular font pattern like this :
>
> Heading 1
> Explanation ......
>
> Heading 2
> explanation ...
>
> etc
>
> This I can happily do at run time from the database except that I
> can't get
> the headings to be bold - I've tried using the selstart/length properties
> and then selbold which all works but as soon as the next heading
> is selected
> all previous selections (and their bold settings) are lost. I've
> also looked
> at embedding the necessary RTF code around my data but this has not worked
> despite many different approaches.
>
> Anyone else tried this and had more luck?
>
> Simon Lester (020 7332 3984)
>
>
>
>
> THIS E-MAIL AND ANY ATTACHED FILES ARE CONFIDENTIAL AND MAY BE LEGALLY
> PRIVILEGED. If you are not the addressee, any disclosure, reproduction,
> copying, distribution or other dissemination or use of this
> communication is
> strictly prohibited. If you have received this transmission in
> error please
> notify the sender immediately and then delete this e-mail.
> Opinions, advice or facts included in this message are given without any
> warranties or intention to enter into a contractual relationship with the
> Corporation of London unless specifically indicated otherwise by
> agreement,
> letter or facsimile signed by an authorised signatory of the Corporation.
> Any part of this e-mail which is purely personal in nature is not
> authorised
> by the Corporation of London. All e-mail through the Corporation's gateway
> is potentially the subject of monitoring.
> All liability for errors and viruses is excluded.
>
>
>
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills
> from Visual Basic 6 to C#, the language of choice
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
>
>
>
>
> ---
> Visual C# - A Guide for VB6 Developers
> This book will make it easy to transfer your skills
> from Visual Basic 6 to C#, the language of choice
> of the .NET Framework.
> http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
>
>
>
> THIS E-MAIL AND ANY ATTACHED FILES ARE CONFIDENTIAL AND MAY BE LEGALLY
> PRIVILEGED. If you are not the addressee, any disclosure, reproduction,
> copying, distribution or other dissemination or use of this
> communication is
> strictly prohibited. If you have received this transmission in
> error please
> notify the sender immediately and then delete this e-mail.
> Opinions, advice or facts included in this message are given without any
> warranties or intention to enter into a contractual relationship with the
> Corporation of London unless specifically indicated otherwise by
> agreement,
> letter or facsimile signed by an authorised signatory of the Corporation.
> Any part of this e-mail which is purely personal in nature is not
> authorised
> by the Corporation of London. All e-mail through the Corporation's gateway
> is potentially the subject of monitoring.
> All liability for errors and viruses is excluded.
>
>
---
Visual C# - A Guide for VB6 Developers
This book will make it easy to transfer your skills
from Visual Basic 6 to C#, the language of choice
of the .NET Framework.
http://www.wrox.com/ACON11.asp?ISBN=1861007175&p2p0059
THIS E-MAIL AND ANY ATTACHED FILES ARE CONFIDENTIAL AND MAY BE LEGALLY
PRIVILEGED. If you are not the addressee, any disclosure, reproduction,
copying, distribution or other dissemination or use of this communication is
strictly prohibited. If you have received this transmission in error please
notify the sender immediately and then delete this e-mail.
Opinions, advice or facts included in this message are given without any
warranties or intention to enter into a contractual relationship with the
Corporation of London unless specifically indicated otherwise by agreement,
letter or facsimile signed by an authorised signatory of the Corporation.
Any part of this e-mail which is purely personal in nature is not authorised
by the Corporation of London. All e-mail through the Corporation's gateway
is potentially the subject of monitoring.
All liability for errors and viruses is excluded.