简体   繁体   English

如何将文本从文本框中放置到RichTextBox VB中,以及如何向RichTextBox中添加其他文本

[英]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. 我想知道如何将用户从文本框中放置的文本放入RichTextBox中。 For example: 例如:

TextBox = Waffles 文字框= 华夫饼

RichTextBox = These (Text from TextBox) are good RichTextBox =这些(来自TextBox的文本)很好

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

EDIT : Updated with further question from OP in comments. 编辑 :在OP中用OP的进一步问题进行了更新。

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 & """ 或者在您的情况下,RichTextBox.Text =“”“&TextBox.Text&”“”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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