简体   繁体   中英

How to place text from a textbox into a richtextbox vb and add extra text to the RichTextBox

I want to know how to take the text a user places from a textbox into a RichTextBox. For example:

TextBox = Waffles

RichTextBox = These (Text from TextBox) are good

TextBox.Text = "Waffles"
RichTextBox.Text = TextBox.Text & "Text to Add"

EDIT : Updated with further question from OP in comments.

How can I add quotation marks to the text?

To print quotation mark in a string you need to enclose them in string delimiter quotes:

dim str as String
dim quotedStr as String
str = "My Text"
quotedStr = """ & str & """

Or in your case RichTextBox.Text = """ & TextBox.Text & """

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM