473,395 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

surpress newline on Enter press

hi, i have a control that inherits from RichTextBox. What i want to be able
to do is surpress the Enter key inserting a newline into the text. For
instance, in AIM when you press Enter, it doesnt insert a new line, it sends
the message. Thats the kind of thing i want to be able to do. How can i do
this?

thanks
--
-iwdu15
Aug 2 '06 #1
3 1410
ag
Capture the KeyChar of Enter i.e. 13 and call some other method on
KeyDown event

Aug 2 '06 #2
even if i catch the enter keypress, it still goes through...how can i stop it
from going through?
--
-iwdu15
Aug 2 '06 #3
iwdu15 wrote:
hi, i have a control that inherits from RichTextBox. What i want to be able
to do is surpress the Enter key inserting a newline into the text. For
instance, in AIM when you press Enter, it doesnt insert a new line, it sends
the message. Thats the kind of thing i want to be able to do. How can i do
this?

thanks
I believe this is what you want (Watch for line-wrapping) -

Private Sub RichTextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles RichTextBox1.KeyDown

If e.KeyCode = Keys.Return Then
e.SuppressKeyPress = True
'The "Return/Enter Key" is now absorbed
'Now do something else here.....
End If

End Sub
ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Aug 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: J Swift | last post by:
I need to surpress the following warning that taking place during build/re-build *warning C4018: '<' : signed/unsigned mismatch I don't want to fix the cause because it's part of the way the...
3
by: Hsg | last post by:
Hi all.. in C# , and specally in Forms ... i had creat a form , the user enter Inputs , and then press the Button ... is there a way that the user will have teh choice to press the Button on...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
2
by: John Salerno | last post by:
If I read a string that contains a newline character(s) into a variable, then write that variable to a file, how can I retain those newline characters so that the string remains on one line rather...
2
by: jonathan184 | last post by:
Hi I am try to create a script to login EMS admin tool *JMS* Now the admin account has a blank password. so if i login normal usually i type this: i press enter username(ADMIN) prompt - i...
24
by: MichaelK | last post by:
Who knows how to prevent submitting a form on the press Enter button before all fields on the form are filled up. People just enter the first field hit Enter and it submits the form and doing...
0
by: SentinalBlade | last post by:
I have an executable that is disassembeled into ASM, but cannot edit it directly very easily, and if i set soemthing to NOP through my debugger, it adds more line adresses that screws up the whole...
1
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the...
0
by: Steve K | last post by:
to this newline when an enter key is detected. Update: I tried adding this code: <code> public PMDDataGridViewTextBoxEditingControl() :base() { this.Multiline = true; } </code>
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.