add string at end of rtf property of RichEditBox

  • Thread starter Thread starter Sandra Setz
  • Start date Start date
S

Sandra Setz

Hi,

Can someone explain to me why it isn't possible to add strings after the rtf
property of a RichEditBox? For example, I am trying to create an SQL string
as
follows:

Dim sSQL As String = "UPDATE tblRecipe SET Preparation='" &
txtPreparation.Rtf & "' WHERE Id=35"

For some reason, the text after the Rtf property is not added to the string
sSQL. What is it I am doing wrong? Is there another way I can build this
query?

Thanks in advance,
Sandra
 
* "Sandra Setz said:
Can someone explain to me why it isn't possible to add strings after the rtf
property of a RichEditBox? For example, I am trying to create an SQL string
as
follows:

Dim sSQL As String = "UPDATE tblRecipe SET Preparation='" &
txtPreparation.Rtf & "' WHERE Id=35"

Are you sure you are not looking for the 'Text' property?
For some reason, the text after the Rtf property is not added to the string
sSQL. What is it I am doing wrong? Is there another way I can build this
query?

Maybe the string contained in the 'Rtf' property ends with a null
character. When appending the text, the IDE and/or message box and/or
some controls won't show the whole string because they think it ends at
the null character.
 
Can someone explain to me why it isn't possible to add strings after the
rtf
Are you sure you are not looking for the 'Text' property?

No, since I want to save the rtf-format into the database as well, so I need
the rtf property.
Maybe the string contained in the 'Rtf' property ends with a null
character. When appending the text, the IDE and/or message box and/or
some controls won't show the whole string because they think it ends at
the null character.

Mmm, how do I check this?

Sandra
 
Use txtPreparation.Text instead.

But then I don't save the rtf-formatting, and that's what I want.

Sandra
 
* "Sandra Setz said:
Mmm, how do I check this?

You can use 'InStr' or the string's 'IndexOf' method to search for
'ControlChars.NullChar'. If it's part of the string, you can use 'Mid'
or the string's 'Substring' method to get the part of the string without
the null character. After getting rid of this character (if it is part
of the string), concatenate the other string to the end.
 
You can use 'InStr' or the string's 'IndexOf' method to search for
'ControlChars.NullChar'. If it's part of the string, you can use 'Mid'
or the string's 'Substring' method to get the part of the string without
the null character. After getting rid of this character (if it is part
of the string), concatenate the other string to the end.

Yeah, this was the problem. Thanks. It seems to work now.

Sandra
 
* "Sandra Setz said:
You can use 'InStr' or the string's 'IndexOf' method to search for
'ControlChars.NullChar'. If it's part of the string, you can use 'Mid' [...]
Yeah, this was the problem. Thanks. It seems to work now.

Thanks for confirming that!
 
Herfried K. Wagner said:
* "Sandra Setz said:
You can use 'InStr' or the string's 'IndexOf' method to search for
'ControlChars.NullChar'. If it's part of the string, you can use 'Mid'
[...]
Yeah, this was the problem. Thanks. It seems to work now.

Thanks for confirming that!

You're welcome ;-)

Sandra
 
Back
Top