我尝试mekae程序如何告诉我在richbox中我做什么检查,我有4个CheckBoxes当我点击一个启用RichBox必须apear 苹果启用... 梨残疾人...... 所以我有苹果梨胡萝卜花生 和richbox需要看起来像,
梨禁用...... 胡萝卜残疾人...... 花生启用... 梨启用.... 提交成功! 梨禁用...... 我尝试每个复选框,但当我检查一个richbox重置并且apear只有一行
If CheckBox2.Checked = True Then
RichTextBox1.Text = "pear enabled..."
Else
RichTextBox1.Text = "pear disabled..."
End If
我该怎么办? 谢谢!
答案 0 :(得分:1)
也许你需要这个:
If CheckBox2.Checked = True Then
RichTextBox1.Text &= "pear enabled..." & Environment.NewLine()
Else
RichTextBox1.Text &= "pear disabled..." & Environment.NewLine()
End If
答案 1 :(得分:1)
您可以简单地使用Rich Text Box控件的SelectedText属性来正确附加文本。请参阅以下代码..
Public Class Form1
Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged
If (CheckBox1.Checked) Then
RichTextBox1.SelectedText = CheckBox1.Text & " Enabled" & vbCrLf
Else
RichTextBox1.SelectedText = CheckBox1.Text & " Disabled" & vbCrLf
End If
End Sub
Private Sub CheckBox2_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox2.CheckedChanged
If (CheckBox1.Checked) Then
RichTextBox1.SelectedText = CheckBox2.Text & " Enabled" & vbCrLf
Else
RichTextBox1.SelectedText = CheckBox2.Text & " Disabled" & vbCrLf
End If
End Sub
Private Sub CheckBox3_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox3.CheckedChanged
If (CheckBox1.Checked) Then
RichTextBox1.SelectedText = CheckBox2.Text & " Enabled" & vbCrLf
Else
RichTextBox1.SelectedText = CheckBox2.Text & " Disabled" & vbCrLf
End If
End Sub
结束班
答案 2 :(得分:0)
您正在寻找的词是“附加”文字。
RichTextBox1.AppendText(“启用了梨......”)