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

ENTER KEYPRES

How can I disable a beep when I press Enter on TexBox
I'm trying this but it don't work:

I do it in KeyDown event

If e.KeyCode = Windows.Forms.Keys.Enter Then
' Do something ...
e.Handled = True
End If

------------------------------------------------------------------
Also can anyone tell me a good idea about this:
I want to do that when I press Enter on TextBox the focus must get second
TextBox and so on...
Nov 20 '05 #1
10 1255
Wont answer your post if you x-post to this many newsgroups.
A fair few people actually block posts that are x-posted to too many
newsgroups as this is sometimes a tactic that spammers use.
Your first question is easy in vb6 but I would have to see if the same works
in .NET.
As for your second question I can tell you exactly how to do that if you
care to not x-post.
Cheers
Newsgroup Nazi

"msnews.microsoft.com" <da*********@hotmail.com> wrote in message
news:uX*************@TK2MSFTNGP11.phx.gbl...
How can I disable a beep when I press Enter on TexBox
I'm trying this but it don't work:

I do it in KeyDown event

If e.KeyCode = Windows.Forms.Keys.Enter Then
' Do something ...
e.Handled = True
End If

------------------------------------------------------------------
Also can anyone tell me a good idea about this:
I want to do that when I press Enter on TextBox the focus must get second
TextBox and so on...

Nov 20 '05 #2
"msnews.microsoft.com" <da*********@hotmail.com> schrieb

Please post to the appropriate groups only!!
How can I disable a beep when I press Enter on TexBox
I'm trying this but it don't work:

I do it in KeyDown event

If e.KeyCode = Windows.Forms.Keys.Enter Then
' Do something ...
e.Handled = True
End If
The beep isn't created because you hold down the Enter key but because
chr(13) is received and is "of no use" for the textbox. Ctr+M also creates
chr(13) but is not the enter key. Handle the KeyPress event instead:

If e.KeyChar = Chr(13) Then
e.Handled = True
End If
------------------------------------------------------------------
Also can anyone tell me a good idea about this:
I want to do that when I press Enter on TextBox the focus must get
second TextBox and so on...


That's not standard behavior, but if you need it, call the SelectNextControl
of the control. In *keydown*:

If e.KeyCode = Windows.Forms.Keys.Enter Then
e.Handled = True
directcast(sender, control).selectnextcontrol(...)
End If

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
Hi,

Despite the other message, please keep crossposting and go not to
multiposting.
However it is a little bit to much to send a message to a C# group for
VB.net code.

You can try this, normaly Armin puts this code in this newsgroup, however
when he sees a message with so many C# he maybe will not answer, he is very
strict in that.

I hope this helps?

Cor

\\\
Private Sub TextBox1_KeyPress( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyPressEventArgs) _
Handles TextBox1.KeyPress
If e.KeyChar = vbCr Then
e.Handled = True
End If
End Sub
///
Nov 20 '05 #4
msnews.microsoft.com wrote:
How can I disable a beep when I press Enter on TexBox
I'm trying this but it don't work:

I do it in KeyDown event

If e.KeyCode = Windows.Forms.Keys.Enter Then
' Do something ...
e.Handled = True
End If
don't know this one, probably error related.
Also can anyone tell me a good idea about this:
I want to do that when I press Enter on TextBox the focus must get second
TextBox and so on...


You can do this:

private void MyTextBox_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
SendKeys.Send("{TAB}");
}
}

FB
--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
Nov 20 '05 #5
"Cor Ligthert" <no**********@planet.nl> schrieb
You can try this, normaly Armin puts this code in this newsgroup,
however when he sees a message with so many C# he maybe will not
answer, he is very strict in that.


Not necessary to make a discussion about me in your answer, don't you think
so?
--
Armin

Nov 20 '05 #6
I did want to answer this, because of the crossposting and it is normaly
your code.

That was the only reason.

Cor
Nov 20 '05 #7
"Cor Ligthert" <no**********@planet.nl> schrieb
I did want to answer this, because of the crossposting and it is
normaly your code.

That was the only reason.


I don't like that you post "he is very strict in that" about me to several
groups.
--
Armin

Nov 20 '05 #8
Hi Armin,

Sorry, do not do that anymore, however there is nothing meant wrong with.

Cor
Nov 20 '05 #9
* "msnews.microsoft.com" <da*********@hotmail.com> scripsit:
[...]

I remember I saw this question somewhere else.

Please stop posting English language questions to non-English groups.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #10
Armin,

Good to see you back. Hadn't seen you post in a while.

By the way has anybody heard from Fergus?

Nov 20 '05 #11

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

Similar topics

5
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number...
4
by: msnews.microsoft.com | last post by:
How can I disable a beep when I press Enter on TexBox I'm trying this but it don't work: I do it in KeyDown event If e.KeyCode = Windows.Forms.Keys.Enter Then ' Do something ... e.Handled =...
5
by: ewillyb | last post by:
Hi, ASP.NET has some interesting behavior when the user hits the Enter key. If there are multiple ASP:Buttons (rendered as HTML submits) on the form, when the user hits enter, the first button's...
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...
6
by: Clark Sann | last post by:
Can someone help me understand what object should be used as the lock object? I've seen some programs that use Monitor.Enter(Me). Then, in those same programs, they sometimes use another object. ...
7
by: Marc | last post by:
Hi, I want my user to be able to rename a button control by selcting rename from a menu. This then opens a text box in which to enter the new name in. I want the button control to...
18
by: Zytan | last post by:
I want the same function to be run whether you press Enter or double click the listbox. It seems really verbose to write both handlers to both events everytime, even if they both call the same...
2
by: JWest46088 | last post by:
I want the user to enter information, such as names, and then I want to ask them after they entered the first name if they want to enter another name. How would I do that? This is what I have so...
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.