[RESOLVED] another Enter key event question
When the enter key is pressed, I would like to have <br /> added to the end of a each line in multiline textbox then allow me to type next line. Then repeat for each line.
using Code:
Private Sub TextBox_Body_TextChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox_Body.KeyDown
If e.KeyCode = Keys.Enter Then
TextBox_Body.Text = TextBox_Body.Text + "<br />"
End If
End Sub
works ok for single line. Does however insert a blank line above current text and cursor is at start of second line containing text.
Make sense? :ehh:
Re: another Enter key event question
vb.net Code:
Public Class Form1
Private Sub TextBox_Body_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox_Body.KeyDown
If e.KeyCode = Keys.Enter Then
TextBox_Body.Text = TextBox_Body.Text & "<br />"
TextBox_Body.SelectionStart = TextBox_Body.TextLength
End If
End Sub
End Class
:wave:
Re: another Enter key event question
Wow Thanks...Works PERFECT
Re: another Enter key event question
Quote:
Originally Posted by
whatwasithinking
Wow Thanks...Works PERFECT
Welcome :wave: