Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2004

Tip: Looking for answers? Try searching our database.

How to set focus to controls when i press enter key in VB.NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mamatha - 30 Oct 2004 09:00 GMT
Hi

I have a samll application.
In that i have one textbox and one button.
When i enter some text in text box and press enter then
the button will have a focus.
How can i do this?

Mamatha
Igor Stanek - 30 Oct 2004 09:19 GMT
Try this:

   Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
       If e.KeyChar = Microsoft.VisualBasic.ChrW(13) Then
           Me.Button1.Focus()
       End If
   End Sub
or:

   Private Sub TextBox1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
       If e.KeyCode = Keys.Enter Then
           Me.Button1.Focus()
       End If
   End Sub

spigi
Hello Mamatha,

> Hi
>
[quoted text clipped - 4 lines]
> How can i do this?
> Mamatha

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.