473,986 Members | 57,223 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1449
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_Ke yDown(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles RichTextBox1.Ke yDown

If e.KeyCode = Keys.Return Then
e.SuppressKeyPr ess = 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
1470
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 program works, but How do surpress the warning?
3
1767
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 the form , or just simply Press the Enter Button in his Key Bord ..?
15
4076
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 CALLING FORM! This is very bad for me, because in my application, Form1 responds to an ENTER keypress by calling Form2. If the user closes Form2 via an ENTER, then Form1 just reopens it again, kind of trapping the user in Form2 (they can still close...
2
5696
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 than spans multiple lines? Example: In a CGI script, I'm reading the address field from an HTML form. Almost always the person will press ENTER so they can enter a second or third line. If I then want to write all the field values of this form...
2
4745
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 press enter password - i press enter then i am int he system , so basically i press enter twice at the prompts* default admin acct this is what i am using*
24
8471
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 validation, of course flushing with the bunch of messages because rest of the fields are empty. I remember I had some pages where wrote the code to go on the next field when pressed the Enter button (Tab like), because it didn't go anywhere at all....
0
1070
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 script and/or creates an error that a result couldnt be found(as expected) Is there Currently a way to "surpress" checking of signed files( i believe it is sha6), i would like to replace some with ones i have generated myself, but the executable...
1
7052
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 page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
0
1887
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
10203
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10967
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
10135
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8515
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7668
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6471
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
5215
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3812
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.