|
-
Mar 22nd, 2011, 11:21 AM
#1
Thread Starter
Lively Member
[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?
-
Mar 22nd, 2011, 11:35 AM
#2
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
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
-
Mar 22nd, 2011, 11:38 AM
#3
Thread Starter
Lively Member
Re: another Enter key event question
Wow Thanks...Works PERFECT
-
Mar 22nd, 2011, 11:45 AM
#4
Re: another Enter key event question
 Originally Posted by whatwasithinking
Wow Thanks...Works PERFECT
Welcome
If my post was helpful to you, then express your gratitude using Rate this Post. 
And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet
Social Group: VBForums - Developers from India
Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|