473,385 Members | 1,338 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,385 software developers and data experts.

TextBox.AcceptsReturn Property

Am I doing something wrong or does the TextBox.AcceptsReturn property not
work as documented?

According to the help, "true if the ENTER key creates a new line of text in
a multiline version of the control; false if the ENTER key activates the
default button for the form."

I don't want the Enter key to create a new line in the textbox. I have the
property set to false but it makes a newline when I type in it anyway...
What's up with that?
Nov 15 '05 #1
4 11415
"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote:
Am I doing something wrong or does the TextBox.AcceptsReturn property not
work as documented?

According to the help, "true if the ENTER key creates a new line of text in
a multiline version of the control; false if the ENTER key activates the
default button for the form."

I don't want the Enter key to create a new line in the textbox. I have the
property set to false but it makes a newline when I type in it anyway...
What's up with that?


From
http://msdn.microsoft.com/library/de...turntopic.asp:

"If the value of this property is false, the user must press
CTRL+ENTER to create a new line in a multiline TextBox control. If
there is no default button for the form, then the ENTER key will
always create a new line of text in the control, no matter what the
value of this property."

I'm guessing you have no default button on your form? :-)
Nov 15 '05 #2
"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote:

<snip>

If you don't want the user to be able to insert a new line in a
multi-line text box, and you don't have a default button on your form,
you could do it like this:

private void textBox_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
e.Handled = e.KeyChar == 13;
}
Nov 15 '05 #3

"C# Learner" <cs****@learner.here> wrote in message
news:20********************************@4ax.com...
"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote:
Am I doing something wrong or does the TextBox.AcceptsReturn property not
work as documented?

According to the help, "true if the ENTER key creates a new line of text ina multiline version of the control; false if the ENTER key activates the
default button for the form."

I don't want the Enter key to create a new line in the textbox. I have theproperty set to false but it makes a newline when I type in it anyway...
What's up with that?

From

http://msdn.microsoft.com/library/de...turntopic.asp:
"If the value of this property is false, the user must press
CTRL+ENTER to create a new line in a multiline TextBox control. If
there is no default button for the form, then the ENTER key will
always create a new line of text in the control, no matter what the
value of this property."

I'm guessing you have no default button on your form? :-)


Ah... I scoured MSDN but I missed this... thanks...
Nov 15 '05 #4

"C# Learner" <cs****@learner.here> wrote in message
news:rc********************************@4ax.com...
"Chuck Bowling" <ch**********@sbcglobal-NO-SPAM.net> wrote:

<snip>

If you don't want the user to be able to insert a new line in a
multi-line text box, and you don't have a default button on your form,
you could do it like this:

private void textBox_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
e.Handled = e.KeyChar == 13;
}


Actually what I wanted to do was implement a different behavior than the
default but I don't want to add a default button to my UserControl to do it.

I solved the problem by creating a control inherited from TextBox and
overriding ProcessCmdKey.

Thanks for your help.
Nov 15 '05 #5

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

Similar topics

1
by: mg | last post by:
I have a MultiLine TextBox (WebForm - C#) with the MaxLength property = 1000 but am able to type in an unlimited number of characters. Is there a way to limit the number of characters that can be...
4
by: David Kyle | last post by:
Hello there, I'm having some problems setting the TextBox.Text Property in my code and having it returned to the client in the source when the TextBox.TextMode="Password". I know this is...
6
by: Agnes | last post by:
I create my own usercontrol (textbox), I new a property 'Type' I will set this property during design mode, I will set 'I' OR 'C', i stands for integer, c stands for character, Now, In that...
1
by: mosquito.dotnet | last post by:
I am getting clearly wrong values from TextBox.SelectionStart property in C# code. For example, if I move caret one character to right by pressing Keys.Right, sometimes declared SelectionStart...
1
by: shapper | last post by:
Hello, I am working on Library which will include various controls. One of these controls has a TextBox. I am using a property named Value to define the TextBox text: ' Value Private...
0
by: =?Utf-8?B?Q2hyaXN0aWFuIEJhaG5zZW4=?= | last post by:
Is it possible to bind a data access page textbox controlsource property at run time? I've tried using the BeforeInitialBind event to set the controlsource for textboxes, using syntax like ...
1
by: kostareject | last post by:
Hello! Can anyone tell me how can I printi label/textbox Text property in MDI Child by clicking MDI Parent print button in C#! I have MDI Chil form with several labels and textboxes, and I want...
0
by: kostareject | last post by:
Hello! Can anyone tell me how can I printi label/textbox Text property in MDI Child by clicking MDI Parent print button in C#! I have MDI Chil form with several labels and textboxes, and I want...
10
by: Gary Rubin | last post by:
I am trying to figure out how to get the contents of a textbox text property into an unsigned char array. I have been researching this via google for a few days without any success unfortunately. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.