473,383 Members | 1,877 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,383 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 16 '05 #1
4 5122
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 16 '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 16 '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 16 '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 16 '05 #5

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

Similar topics

5
by: Alan Zhong | last post by:
i am trying to similate an "ENTER" as a key to switch focus in a sequence of text inputs. i don't want to use "event.keyCode" since i want to do additional testing before i decide which text input...
10
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 =...
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: 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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.