473,386 Members | 1,775 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,386 software developers and data experts.

Rtf and variable

Sam
Hi,
How can I assign the content of a string variable to the Rtf property
of a richtextbox :

Dim message As String = txtMessage.Rtf & "[" &
DirectCast(lstFields.SelectedItem, Field).FieldName & "]"
txtMessage.Rtf = "{\rtf1\ansi message}"

This displays 'message' instead of its content :(

Thx

Nov 21 '05 #1
7 1392
Sam wrote:
txtMessage.Rtf = "{\rtf1\ansi message}"


Do you mean:

\\\
txtMessage.Rtf = "{\rtf1\ansi " & message & "}"
///

?

--

(O)enone
Nov 21 '05 #2
Sam
oh ! it was that simple ? thx !
By any luck, do you know how to append text in a richtextbox ?
Something like :

Dim message As String = txtMessage.Rtf & "[" &
DirectCast(lstFields.SelectedItem, Field).FieldName & "]"
txtMessage.Rtf = "{\rtf1\ansi
{\colortbl;\red0\green0\blue0;\red255\green0\blue0 ;} \cf2" & message &
"\cf1}"

That doesn't work :(

Nov 21 '05 #3
Sam
I've found out.... just had to replace txtmessage.rtf & by
txtmessage.text &

Nov 21 '05 #4
Sam
Now I have another problem :
txtMessage.Rtf = "{\rtf1\ansi
{\colortbl;\red0\green0\blue0;\red0\green200\blue0 ;}" & txtMessage.Text
& "\cf2" & message & "\cf0}"

In the above, the color of 'message' is green but then the text that
one types afterward should be black again as I do & "\cf0}". But
instead the text remains always green. Why ?

Nov 21 '05 #5
Sam
also, the following has no effect at all on my text :
txtMessage.SelectionColor = Color.Red
txtMessage.Select(iCntr, 2)

the text is not selected and there's no color change,
can you help ?

Nov 21 '05 #6
Sam
I've found out what's going on,
iCntr was based on my message lenght, but that was comprising all the
Rtf stuff before my actual text. Now iCntr is correct and the text is
selected properly. However it is not red.... why ?

Nov 21 '05 #7
Sam
I've found out what's going on,
iCntr was based on my message lenght, but that was comprising all the
Rtf stuff before my actual text. Now iCntr is correct and the text is
selected properly. However it is not red.... why ?

Nov 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Scott | last post by:
I have an XML Document in a format like: <Variable name="Bob">ABCDEFG</Variable> <Variable name="Steve">QWERTYUI</Variable> <Variable name="John">POIUYTR</Variable> <Variable...
4
by: Frederik Sørensen | last post by:
I include a xslt stylesheet with variables for all the error messages in my system. <xsl:variable name="Banner_error_1"> errormessage 1 for banner </xsl:variable> <xsl:variable...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
112
by: istillshine | last post by:
When I control if I print messages, I usually use a global variable "int silent". When I set "-silent" flag in my command line parameters, I set silent = 1 in my main.c. I have many functions...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.