Sub Form2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If e.KeyChar = Chr(13) Then DoSomething() End If End Sub
This post was a little helpful, and I thank The Lord Jesus for your kind help and expertise. However, I'm still having trouble because I want to force a no line feed in the display text box when the Enter key is pressed.
When the focus is on the text box, and the user presses the Enter (CR) key, how can I tell the text box to do nothing, especially no line feed
I thank The Lord Jesus for His grace that works your response for my good (Romans 8:28 of The Holy Bible).
Keypress Controls in Visual Basic 2005
BrammekeDotNet
Private
Sub Form2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress If e.KeyChar = Chr(13) Then DoSomething() End If End SubPareshPatel
This post was a little helpful, and I thank The Lord Jesus for your kind help and expertise. However, I'm still having trouble because I want to force a no line feed in the display text box when the Enter key is pressed.
When the focus is on the text box, and the user presses the Enter (CR) key, how can I tell the text box to do nothing, especially no line feed
I thank The Lord Jesus for His grace that works your response for my good (Romans 8:28 of The Holy Bible).
BQMartin
Using a Rich Text Box control and VB 2005, I want to do nothing when key is pressed, especially no line feed (CR). In VB 6, this is achieved by ...
KeyAscii = 0.
How do I accomplish in VB 2005 a "nothing response" when the e.KeyChar = Chr(13) condition is raised
Chris Breaux
correct
You can also use the handy Keys Enum off the Window.Forms namespace like so:
If e.KeyChar = Chr(Keys.Return) ThenGood Luck!