您可以简单地使用富文本框控件的 SelectedText 属性来正确附加文本。请看下面的代码..
公开课形式1
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
结束类