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

Set Focus

Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to
textbox B.
Thanks
Nov 21 '05 #1
6 1495
In a Windows Forms application, you would be looking for the enter key being
pressed during textbox A's KeyPress event.
"RedS" <an*******@discussions.microsoft.com> wrote in message
news:27****************************@phx.gbl...
Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to
textbox B.
Thanks

Nov 21 '05 #2
....And, in a Web Forms application, you would write client-side script
(JavaScript) that looks for the enter key being pressed during textbox A's
onKeyPress event handler.
"RedS" <an*******@discussions.microsoft.com> wrote in message
news:27****************************@phx.gbl...
Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to
textbox B.
Thanks

Nov 21 '05 #3
Hellow there, If have try this code dusing keydown event

If e.KeyCode = Keys.Enter then
txtA.Focus()
end if

Its work but when I try to click the textbox A again its
locked. How come this happen?
How to do it in keypress event
Thanks

-----Original Message-----
In a Windows Forms application, you would be looking for the enter key beingpressed during textbox A's KeyPress event.
"RedS" <an*******@discussions.microsoft.com> wrote in messagenews:27****************************@phx.gbl...
Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to textbox B.
Thanks

.

Nov 21 '05 #4
"RedS" <an*******@discussions.microsoft.com> schrieb:
Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to
textbox B.


Enter instead of Tab
<URL:http://blogs.duncanmackenzie.net/duncanma/archive/2004/12/13/936.aspx>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #5
Hi there,
I try the code from the link that you gave, it is work
when there is nothing in textbox A I can move to textbox
B when I press enter and I can also return to textbox A.
But the problem comes when I type something in textbox A
then I press enter and it goes to textbox B but I cant go
back to textbox A. How this thing happen?

Thanks
-----Original Message-----
"RedS" <an*******@discussions.microsoft.com> schrieb:
Hi I have two texbox A and B. What I want to ask is how to set if I press enter in textbox A and it set focus to textbox B.
Enter instead of Tab
<URL:http://blogs.duncanmackenzie.net/duncanma/archive/20

04/12/13/936.aspx>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
.

Nov 21 '05 #6
Assuming that you have a txt1 and txt2 textbox on your WinForm, this code
works for me:

Private Sub txt2_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txt2.KeyPress
If e.KeyChar = Chr(13) Then
txt1.Focus()
End If
End Sub

"RedS" <an*******@discussions.microsoft.com> wrote in message
news:12****************************@phx.gbl...
Hellow there, If have try this code dusing keydown event

If e.KeyCode = Keys.Enter then
txtA.Focus()
end if

Its work but when I try to click the textbox A again its
locked. How come this happen?
How to do it in keypress event
Thanks

-----Original Message-----
In a Windows Forms application, you would be looking for

the enter key being
pressed during textbox A's KeyPress event.
"RedS" <an*******@discussions.microsoft.com> wrote in

message
news:27****************************@phx.gbl...
Hi I have two texbox A and B. What I want to ask is how
to set if I press enter in textbox A and it set focus to textbox B.
Thanks

.

Nov 21 '05 #7

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

Similar topics

4
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for...
17
by: Neil Ginsberg | last post by:
OK, this is a stupid thing, but I can't seem to get this to work. I have a form with a subform (in continuous form view). A combo box on the main form has code in the AfterUpdate event which adds a...
1
by: avnrao | last post by:
Hi, I am facing a problem with control.focus (javascript). Here is the description of the issue. 1. I have 2 aspx files. on Aspx1 I have button named NewRow. Clicking on this, will redirect...
11
by: Alex.Svetos | last post by:
Hello, I'm trying to get a popup to keep focus when it is re-clicked. The script below is supposed to produce this exact behaviour, however it doesn't work, at least on firefox 1.0.7 and moz...
4
by: Roger | last post by:
Hi, I am confused about the differences between this.window.focus(), window.focus(), and this.focus(). I want to use the calls in a <body onload="..."tag. What are the differences between...
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:
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.