For some applications, it is necessary to replace the default keys with another key or action. The following code intercepts the Enter key and inserts a line break instead of a paragraph.
private void textControl1_KeyPress(object sender, KeyPressEventArgs e)
{
if(e.KeyChar.Equals('
'))
{
e.Handled = true;
textControl1.Selection.Text = "";
}
}
Private Sub textControl1_KeyPress(sender As Object, e As KeyPressEventArgs)
If e.KeyChar.Equals(ControlChars.Cr) Then
e.Handled = True
textControl1.Selection.Text = vbVerticalTab
End If
End Sub